如何使用CSS将内容环绕图像?带class的Div.header
应该用其中的文本宽度换行。带班级的div.body
应该在.header
div之后换行。
<div class="block">
<div class="image">
<img src="http://i.stack.imgur.com/SZHzX.jpg" />
</div>
<div class="text">
<div class="header">
Here is header bar
</div>
<div class="body">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
</div>
CSS:
.image {
float: left;
}
.header {
border: 1px solid #000;
margin-bottom: 20px;
}
在此先感谢您,我的英语不好。
使用 display:table-cell
.image {
display: table-cell;
vertical-align:top;
padding-right:5px;
}
.header {
border: 1px solid #000;
margin-bottom: 20px;
display:inline;
}
.text{display: table-cell; vertical-align:top;}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句