Html 替换水平标尺 <hr> 标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11033014/
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
replacement for the horizontal ruler <hr> tag
提问by Chandra Eskay
I'm using the below code to generate a horizontal bar. It works in older brower versions but not in the Internet explorer 9. It won't be visible until I click on 'Compatibility View'. Do we have an alternate for this or has it got replaced?
我正在使用下面的代码来生成一个水平条。它适用于较旧的浏览器版本,但不适用于 Internet Explorer 9。在我单击“兼容性视图”之前,它是不可见的。我们是否有替代方案或已更换?
<hr style="color:#F87431 ; height:7px "/>
回答by Oliver
Try
尝试
<hr style="background:#F87431; border:0; height:7px" />
回答by Jeff Watkins
HR in its original form, like STRIKE, B etc. were far too layout and presentation oriented.
原始形式的人力资源,如 STRIKE、B 等,过于以布局和演示为导向。
HTML 5 is moving the markup towards a more semantic structure with more emphasis the layout being placed on CSS and media elements.
HTML 5 正在将标记移向更具语义的结构,更加强调布局放在 CSS 和媒体元素上。
From the W3C documentation:
从 W3C 文档:
In HTML 4.01, the <hr> tag represented a horizontal rule.
In HTML5, the <hr> tag defines a thematic break.
However, the <hr> tag may still be displayed as a horizontal rule in visual browsers, but is now defined in semantic terms, rather than presentational terms.
So you just need to style it up nicely.
所以你只需要很好地设计它。
回答by Andrei Hardau
I've also use div's for this, something like <div style="width: 100%; height: 7px; background: #F87431; overflow: hidden;">
我也为此使用了 div,例如 <div style="width: 100%; height: 7px; background: #F87431; overflow: hidden;">
回答by IrishChieftain
Try something like this:
尝试这样的事情:
<div style="color:#F87431;height:7px;">-------------------</div>
Don't use the HR as it's deprecated at this stage, and only use inline CSS for testing ;-)
不要使用 HR,因为它在此阶段已被弃用,并且仅使用内联 CSS 进行测试;-)