2010-10-03 137 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