0
我似乎無法弄清楚如何對齊img和複製元素的頂部在宣傳div。有什麼想法嗎?這不會在Chrome中正確排列。css框對齊問題
我看了很多其他的問題,似乎無法弄清楚。
在一天結束時,我希望能夠在div的左上角有一個打孔框,但我想確保文本溢出不會環繞圖像。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style type="text/css">
.promo {
float: left;
width: 200px;
background-color: pink;
}
.promo img {
float: left;
width: 48px;
height: 48px;
background-color: orange;
}
.copy {
float: left;
width: 152px;
background-color: yellow;
}
</style>
</head>
<body>
<div class="promo"> <img src="" alt="" />
<p class="copy">This is the content. I have a lot of contentfff this it s a fodis sod sod sfns s ndosn</p>
<div style="clear:both;"></div>
</div>
<div class="promo"> <img src="" alt=""/>
<p class="copy">This is the content. I have a lot of contentfff this it s a fodis sod sod sfns s ndosn</p>
<div style="clear:both;"></div>
</div>
<div class="promo"> <img src="" alt=""/>
<p class="copy">This is the content. I have a lot of contentfff this it s a fodis sod sod sfns s ndosn</p>
<div style="clear:both;"></div>
</div>
</body>
</html>
我把你的代碼插入[jsFiddle](http://jsfiddle.net/gRFBP/),當我用chrome查看它時,它給了我一張開心的臉。這還沒有做你想要的嗎? – gmeben
出於某種原因,這似乎工作在jsfiddle,但如果你把代碼,並將其放入一個HTML文件,然後打開它在鉻中的文字似乎出現了一半的形象。 – GuidoS
因爲您需要通過在其上應用'margin:0'來重置'p'標籤的默認樣式,所以存在額外的空間。如果關閉jsFiddle中的Normalized.css,可以觀察到這種行爲。 – gmeben