2010-10-03 151 views
3

我想擁有像背景圖像一樣的人力資源。一個2像素寬的gif文件。
我看着造型的HR標籤,但是過多的瀏覽器的問題..
CSS假背景圖像與背景圖像

使用圖像作爲BG 2px的高格,但在IE6中,有填充我似乎無法擺脫。
歡迎任何建議!

CSS:

.hr { 
    margin: 0; padding: 0; 
    height: 2px; 
    background-image: url('images/help-hr.gif'); 
    background-repeat: repeat-x; 
    background-color: green; /* just to see the padding in IE6 */ 
} 

HTML:

<p>sky</p> 
<div class="hr"></div> 
<p>grass</p> 

回答

2

添加溢出:隱藏;

.hr { 
    margin: 0; padding: 0;  
    height: 2px;  
    background-image: url('images/help-hr.gif'); 
    background-repeat: repeat-x; 
    background-color: green; /* just to see the padding in IE6 */ 

    overflow:hidden; 
} 
+0

完美的莫克沙,歡呼聲:-) – FFish 2010-10-03 15:41:56

0

我不知道答案,你處理的IE6的問題,但我有同樣的問題,使用hrfound a solution那爲我工作:

hr { 
    background-color: #ccc; 
    border-width: 0; 
    color: #ccc; 
    height: 2px; 
    line-height: 0; 
    margin: -.5em 10px 1.8571em 10px; 
    page-break-after: always; 
    text-align: center; 
    width: 80%; 
} 

hr:after { 
    content: "\a7\a7"; 
    font-size: 1.25em; 
} 
+0

謝謝你的人力資源造型和參考。但我更喜歡背景圖片。 – FFish 2010-10-03 15:43:26