所以我在this question的時候找到了一個答案,當時我正在尋找hr標籤的替代品,這將允許我在hr的中間輸入一些文本。它工作,看起來不錯,但有一個問題(值得我相信它自己的問題)。在分隔符下面的任何東西都會被跨度的背景顏色剪切和隱藏。如何清除固定高度的div和內部跨度?
<div style="height: 2px; background-color: #006600; text-align: center;">
<span style="padding: 0px 3px; background-color: white; position: relative; top: -0.6em;">Horizontal Separator</span>
</div>
<div>Stuff that can be hidden by the span!Stuff that can be hidden by the span!</div>
什麼我需要做的,讓這個不能有任何重疊都自帶之後的跨度和什麼之間?我嘗試在另一個div中包裝分隔符,並使用清除,溢出等,但沒有任何我能想到的實際上使其他div脫離span的方式。我想用目前的分離器甚至可以做到這一點,還是我需要改變它?
這個作品,我用餘量,而不是margin-bottom雖然,而em值而不是像素。我想我真的只是在想那麼簡單的事情。 – Crag 2011-03-11 19:49:18
@Crag我們都會這樣做:) – 2011-03-11 19:51:24
更新後的示例以符合@ subhaze的建議他是正確的0.6em將是最準確的值 – 2011-03-11 19:54:51