July 4, 201115 yr I have several hr's on a webpage and are styled as follows: <hr color="#990000" size="0.5px" width="600px" /> This works fine and displays as I want it. However, when I run it through an HTML validator, I get these errors: Line 143, Column 20: there is no attribute "color" <hr size="2" color="#990000" /> So I created a div id in my css file: #hr { color: #990000; size: 0.5; width: 400px; } Html: <div id="hr"> <hr> </div> Doesn't work. Also tried class, no joy. In addition to getting the first error I also get: Line 170, Column 13: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag <div id="hr"> I'm tempted to just ignore the errors as it works my way but I fear that may come back to bite me one day! What am I doing wrong? Edited July 4, 201115 yr by Webtastic
July 4, 201115 yr I have several hr's on a webpage and are styled as follows: <hr color="#990000" size="0.5px" width="600px" /> This works fine and displays as I want it. However, when I run it through an HTML validator, I get these errors: Line 143, Column 20: there is no attribute "color" <hr size="2" color="#990000" /> So I created a div id in my css file: #hr { color: #990000; size: 0.5; width: 400px; } Html: <div id="hr"> <hr> </div> Doesn't work. In addition to getting the first error I also get: Line 170, Column 13: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag <div id="hr"> I'm tempted to just ignore the errors as it works my way but I fear that may come back to bite me one day! What am I doing wrong? http://css-tricks.com/snippets/css/cross-browser-hr-styling/
July 4, 201115 yr Depending upon in which context but i'd say normally you're better off avoiding HR's and just apply a border to the section you need the rule i.e. to the bottom or top of a <p>, <div> etc...
July 4, 201115 yr Author Depending upon in which context but i'd say normally you're better off avoiding HR's and just apply a border to the section you need the rule i.e. to the bottom or top of a <p>, <div> etc... Hi there I'm still struggling to get this working correctly. Just to reiterate on what I'm trying to achieve: A PARAGRAPH OF TEXT -----HR LINE UNDERNEATH------ A PARAGRAPH OF TEXT -----HR LINE UNDERNEATH------ A PARAGRAPH OF TEXT The only way I can get the line showing in the color and size I want is to add this: <hr color="#990000" size="0.5px" width="400px" /> My brain is fried from one of the validator tools which has kept me busy all day (got all my webpages passed eventually, accept this one with HR's! ) Can you give me a simple example of how to add a line after each paragraph? A div id or div class I'm guessing?
July 4, 201115 yr Hi there I'm still struggling to get this working correctly. Just to reiterate on what I'm trying to achieve: A PARAGRAPH OF TEXT -----HR LINE UNDERNEATH------ A PARAGRAPH OF TEXT -----HR LINE UNDERNEATH------ A PARAGRAPH OF TEXT The only way I can get the line showing in the color and size I want is to add this: <hr color="#990000" size="0.5px" width="400px" /> My brain is fried from one of the validator tools which has kept me busy all day (got all my webpages passed eventually, accept this one with HR's! ) Can you give me a simple example of how to add a line after each paragraph? A div id or div class I'm guessing? I've already shown you. http://css-tricks.com/snippets/css/cross-browser-hr-styling/ Some browsers handle HR's differently. IE uses color, other browsers use background-color. Might be the other way around. So you have to assign both to your styles. If you want to add a bottom border to a paragraph do this: p {border-bottom:2px solid black} Or, if you don't want all paragraphs to have a bottom border, use a class. p.border {border-bottom:2px solid black} <p class="border">Text goes here</p>
July 4, 201115 yr I did an analysis of the various ways to code <hr> here:- http://www.wickham43.net/horizontalrule.html and in the end you have to code with lots of styles to get what you want in lots of browsers.
Create an account or sign in to comment