我想要做這樣的事情:如何在div類中設置圖像的樣式?
.even {
float: left;
text-align: left;
}
.even img {
float: right;
}
它不工作,雖然。我希望我的問題只是一種語法,但我看不出如何做到這一點。我在谷歌周圍挖掘,但我無法找到正確的關鍵字集。
相關的HTML我想使用應該是這個樣子的部份:
<div class="linkBlock even">
<img class="linkThumbnail" src="graphics/links/thumbnail_oilcan.jpg" width="267" height="200"/>
<h2><a href="http://www.etsy.com/shop/oilcanpress" rel="nofollow">oilcan press</a></h2>
<p>
oilcan press is a purveyor of handmade books & word-related artefacts.
if you'd like to commission work of a particular size or shape or theme let him
know via etsy or email: oilcanpress [!at] gmail.com
they will gladly make custom boxes as per your general requests of colors/concepts.
if you are desirous of sevral items a bundle can be arranged at reduced prices.
</p>
<p>
you can view much of his work on <a href="http://www.etsy.com/shop/oilcanpress">flickr</a>.
</p>
</div>
我想該塊的文本和浮動左對齊,與圖像浮動權。使用上面所寫的代碼,圖像正位於文本上方的頁面中央;它不是浮動的,它看起來仍然在使用靜態佈局。
這個語法看起來不錯。你試圖達到的究竟是什麼? – 2011-03-28 00:43:24
@AndrewCooper:請參閱上面的修改。謝謝參觀。 – JoshuaD 2011-03-28 00:46:29
該代碼似乎在JSFiddle中工作正常 - 請參閱http://jsfiddle.net/kgEAc/1/ – 2011-03-28 00:51:21