Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replacement for the horizontal ruler <hr> tag

Tags:

html

css

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?

<hr style="color:#F87431 ; height:7px "/>
like image 920
Chandra Eskay Avatar asked Jun 14 '12 12:06

Chandra Eskay


People also ask

What can I use instead of HR tag?

The width attribute on the hr element is obsolete. Use CSS instead. The noshade attribute on the hr element is obsolete. Use CSS instead.

How do I draw a horizontal line in CSS without HR?

Its simple to add a horizontal line in your markup, just add: <hr>. Browsers draw a line across the entire width of the container, which can be the entire body or a child element.


3 Answers

Try

<hr style="background:#F87431; border:0; height:7px" /> 
like image 53
Oliver Avatar answered Sep 24 '22 11:09

Oliver


HR in its original form, like STRIKE, B etc. were far too layout and presentation oriented.

HTML 5 is moving the markup towards a more semantic structure with more emphasis the layout being placed on CSS and media elements.

From the W3C documentation:

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.

like image 20
Jeff Watkins Avatar answered Sep 22 '22 11:09

Jeff Watkins


I've also use div's for this, something like <div style="width: 100%; height: 7px; background: #F87431; overflow: hidden;">

like image 44
Andrei Hardau Avatar answered Sep 21 '22 11:09

Andrei Hardau