Jump to content

<hr> styles


SmokingMan

Recommended Posts

If all presentation attributes of <hr> have been deprecated, and can't be used in XHTML 1.0 Strict, what property values can you use to define the color, width, size, and centering of <hr> in CSS? I looked but could not find anything in the CSS reference as far as what properties are available for the <hr> tag.

Link to comment
Share on other sites

I wondered the same thing, then somone told me to use borders and that made perfect sense.So, if you wanted an "hr" just use a border-bottom or border-top and you are gold! :)

border-bottom: 3px solid #9c9;

type thing. Works like a champ.

Link to comment
Share on other sites

So you have seen this (posting it mainly for others):http://www.w3schools.com/tags/tag_hr.aspSimilarly:http://www.blooberry.com/indexdot/html/tagpages/h/hr.htm<hr> is not presentational, but structural: a lightweight section separator.The only thing wrong with <hr> is that it is not (necessarily) horizontal, and not (necessarily) a rule!So, here is your answer:color = no problem using CSSwidth = no problem using CSSsize = no problem using CSS (use height)border = no problem using CSSbackground color = no problem using CSScenter = assumed center, but can be absolutely positioned with CSSHere is an example I whipped up:http://www.iribbit.net/_files/hr.htmP.S. The <hr> tag assumes the center alignment - the ONLY way around that was to do this "position:absolute; left:5px;" in the style tag. If you take out the absolute positioning, its much more manageable.

Link to comment
Share on other sites

Thanks for your help. I'm working on converting my pages to XHTML Strict in order to not only write better structured code with XHTML, but to continue to teach myself how to use CSS better than I am up to this point. I really appreciate the link to blooberry.com. It's a wealth of information. It's a great additional resource to compliment the W3C tutorials and references. At this point web design is just a hobby, but I would like to be more knowledgable than I currently am. I want to know how to code my pages, not how to use a WYSIWYG editor.

Link to comment
Share on other sites

Thanks for your help.  I'm working on converting my pages to XHTML Strict in order to not only write better structured code with XHTML, but to continue to teach myself how to use CSS better than I am up to this point.  I really appreciate the link to blooberry.com.  It's a wealth of information.  It's a great additional resource to compliment the W3C tutorials and references.  At this point web design is just a hobby, but I would like to be more knowledgable than I currently am.  I want to know how to code my pages, not how to use a WYSIWYG editor.

Glad it worked out. Hats off to you going the strict route - I wish I had the time to pursue that. :) I updated the code, In my section where I showed the source code, I had inadvertantly include teh code used to show the "Valid XHTML" button - which obviously doesn't relate to the solution. So I took it out so its easier to see how the code would really look - just the three lines.Happy Coding!!!
Link to comment
Share on other sites

I normally don't have the time, but I'm at home recovering from surgery. I'm using the time for this and teaching myself javascript. It keeps me busy, otherwise I would be going stir crazy.

Link to comment
Share on other sites

P.S.  The <hr> tag assumes the center alignment - the ONLY way around that was to do this "position:absolute; left:5px;" in the style tag.

Nope, just use margins as usual. Also, I think you meant "in the style attribute" which is wrong. CSS can always be used in an internal or external stylesheet. The style attribute should be discouraged.BTW, S@m was very right in recommending the use of borders. Most of the time you'd save yourself a lot of time using CSS borders especiall when it is for presentation.
Link to comment
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...