我想实现以下位置:
两个不同的文本(在块中)浮动/内嵌在图像旁边。 (div 内的所有内容)。
我一直在尝试不同的显示设置(块 + 内联文本等),但它仍然无法正常工作。
HTML:
<div class="res">
<img src="<?php echo 'img/'.$row["sType"].'.png';?>"/>
<span>TITLEe</span>
<span>Description</span>
</div>
CSS:
.res {
height:60px;
background-color:yellow;
border-bottom:1px solid black;
text-align:left;
}
.res img {
margin-top:8.5px;
margin-left:5px;
display:inline
}
.res span {
display:block;
}
原文由 John 发布,翻译遵循 CC BY-SA 4.0 许可协议