我有一些关于“foo”和“bar”图像的短文本。我想将图像和这些相应的文本并排排列,目前我用::after
伪元素到达它。小文本和大图像并排使用flexbox
但也许,更好的方法来实现它,也许使用flexbox?
<style>
.image { width: 510px; float: right; }
p::after {
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
</style>
<div class="image">
<img src="Foo.jpg">
<p class="caption">Caption</p>
</div>
<p>Text about Foo. Text text text text text text text text text
text text text text text text text text text text text text text
text text</p>
<div class="image">
<img src="Bar.jpg">
<p class="caption">Caption</p>
</div>
<p>Text about Bar. Text text text text text text text text text
text text text text text text text text text text text text text
text text</p>
你想要图像居中和文字在双方?我真的不明白你的预期.. – Ferrrmolina