Html hr 通过 css 带有图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1097095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
hr with an image through css
提问by waqasahmed
I find this a pain. I am trying to get CSS to use an image when the < hr />
tag is used.
I am currently using:
我觉得这很痛苦。我试图让 CSS 在使用< hr />
标签时使用图像。我目前正在使用:
hr
{
display:block;
border:none;
height:10px;
background-image:url('img/ruler.gif');
}
However, I always get a border around the image. As you can see, the border:none
does nothing.
但是,我总是在图像周围设置边框。如您所见,border:none
什么都不做。
I know there are alternative ways such as using div. But is it possible through using the hr tag only?
我知道还有其他方法,例如使用 div。但是是否可以仅使用 hr 标签?
The main users will be using IE6, so need a IE6 compatable solution please. Thanks
主要用户将使用 IE6,因此请需要一个兼容 IE6 的解决方案。谢谢
采纳答案by user3071926
Update border:none;
to border:0;
更新border:none;
到border:0;
回答by BLURSH
hr {
display:block;
border:0px;
height:10px;
background-image:url('img.gif');
}