Jump to content
xisto Community
TavoxPeru

Need Help With The HTML HR Tag

Recommended Posts

Hi, does anybody knows which is the equivalent tag in CSS of the HTML HR tag or how do i replace this. I need this because the HR tag is deprecated and i wanna validate a website.

The code that i need to replace is this:

<hr color='#663300' size='2'>

best regards,

Share this post


Link to post
Share on other sites

That's quite easy in fact. You need to define a HR element in your CSS. Although note that there's some discrepancy in the CSS tags across different browsers. Somewhat like this:

hr {height: 2px;color: #663300;width: 80%;}

IE supports the color tag, while Mozilla and Opera support background-color. You can even use the tag background-image to replace the standard boring rule with some nice separator graphic.

 

Here's a page outlining all you need to know about the HR tag:

Styling HR

Share this post


Link to post
Share on other sites

HR has not been deprecated, but maybe the attributes for it has been. Unless this is XHTML 2.0, though I believe it still exists as well as new introductory tags like separator, etc.If you're using XHTML, then the hr tag is <hr />If you're using HTML then it's just <hr>Cheers,MC

Share this post


Link to post
Share on other sites

Is the page uploaded for us to see and what (exactly) is the warning or error message when you try to validate?

Share this post


Link to post
Share on other sites

HR has not been deprecated, but maybe the attributes for it has been. Unless this is XHTML 2.0, though I believe it still exists as well as new introductory tags like separator, etc.

 

If you're using XHTML, then the hr tag is <hr />

 

If you're using HTML then it's just <hr>

 

Cheers,

MC

 

Sorry folks i confused what is deprecated, so you are right, the HR has not been deprecated, some of its attributes has been.

 

regards,

 

Is the page uploaded for us to see and what (exactly) is the warning or error message when you try to validate?

 

This is the code:

<hr color='#663300' size='2'>

And generate the following warning:

Warning: <hr> proprietary attribute "color"

The tag contains an attribute that is proprietary to Netscape or Internet Explorer.

 

The solution is this and works with IE and Firefox:

<hr style="color:#663300; height:2px; BACKGROUND-COLOR:#663300;">

regards,

Share this post


Link to post
Share on other sites

I don't think color attribute for horizontal rule has never been in W3C recommendation. I could be wrong though.If you don't use HR for some specific trick, I'd recommend setting a consistent style for it using CSS. In normal pages HR should be used in a quite same matter and when you want to differ from it you can use special classes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.