我想要做这样的事情:如何在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