我知道这已经被问过很多次了,但我仍然无法独自完成我想要的。我查看了各种网站以寻求帮助,例如Here和Here以及使用具有垂直对齐、行高等的显示表。
这是我想要完成的(我知道我可能需要添加更多 div)。文本并不总是恒定的,所以我不能只设置填充并完成它,因为红色和蓝色的文本可能会改变长度。
这是我目前拥有的一个简单的 jsFiddle:http: //jsfiddle.net/gP2U8/9/
<div class="container">
<div class="left">
<img src="http://www.gadgets-for-men.co.uk/wp-content/themes/revolution_tech-20/images/rss-icon-50.gif" />
<span>This is text below the image</span>
</div>
<div class="right">
<span>This is text to the right of the image, will usualy contain a lot of text. This is text to the right of the image, will usualy contain a lot of text. This is text to the right of the image, will usualy contain a lot of text. This is text to the right of the image, will usualy contain a lot of text.</span>
</div>
</div>
.container{
border: 1px solid black;
width: 400px;
height: auto;
position: relative;
display: inline-block;
}
.left{
float:left;
width: 25%;
}
.right{
float: right;
width: 75%;
}
.left, .right{
margin-top: 25px;
margin-bottom: 25px;
}