0
有沒有一個更簡單的方法來做到這一點。我只想要背景顏色填充div的頂部寬度,70px高度和div的整個寬度,在這種情況下爲400px。我能夠破解一個解決方案,但它看起來很醜。對不起,我使用內聯樣式,因爲我無法輕鬆地將新的CSS添加到6,500頁的網站。背景顏色填充頂部70px的文本背後的div
<div style="border: 1px solid #bbb; padding:20px; width:400px; height:150px; float:left; margin-right:60px;">
<div style="background:#cccccc; width:440px; height:40px; padding:0; position:relative; margin-left:-20px; margin-top:-20px;"></div>
<div style="background:#cccccc; width:420px; height:30px; padding-left:20px; position:relative; margin-left:-20px; margin-top:-20px;">
<p><b>To learn more:</b></p>
</div>
<p><a href="#" class="btn btn-primary">Contact a sales rep</a></p>
</div>