Click to See Complete Forum and Search --> : css validator


chesswill
09-19-2005, 11:38 AM
This is my CSS for my website. When I run it through the W3 validator it comes up with the following error.

' * Line : 4 (Level : 1) This property applies to block-level elements. : .cntrp
* Line : 5 (Level : 1) This property applies to block-level elements. : .tbordcntrp '



How can I change my style sheet to stop this error?


body {font-family: arial, "sans serif", Monospace, Cursive}
p {font-family: arial, "sans serif", Monospace, Cursive; margin-bottom: 0em;}
body {margin-left: 10%; margin-right: 10%;}
.cntrp {text-align:center}
.tbordcntrp {font-weight:bold; text-align:center}
h1 { font-family: arial, "sans serif", Monospace, Cursive; margin-top:1em; margin-bottom: 0em;}

h2 {font-weight:555; font-family: arial, "sans serif", Monospace, Cursive; margin-top:0em; margin-bottom: 0.5em;}
h3 {margin-bottom: 0em;}
h3,h5,h6 {font-weight:555; font-family: arial, "sans serif", Monospace, Cursive; margin-left: 0%; }
h4{font-weight:555; font-family: arial, "sans serif", Monospace, Cursive; margin-left: 0%; }

www.gordonengraving.co.uk

pointfiftyae
09-19-2005, 11:45 AM
I think the reason is that you can't use the text-align and font-weight properties on every tag. You should specify which tag you are going to give this property. If multiple, separate them with commas.

Fang
09-19-2005, 11:54 AM
Where do those errors come from? The W3C CSS validator does not check the correct use of styles, it only validates the syntax.
The CSS you give differs from your site.
.tbordcntrp is applied to an inline element, so text-align will not work.

Fang
09-21-2005, 02:14 AM
The errors you show can not have come from the W3C validator. validator errors (http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http%3A//www.gordonengraving.co.uk/)
Without errors:body {margin: 0 10%; font-family: arial, Verdana, sans-serif;}
p {margin-bottom: 0;}
.cntrp {text-align:center}
.tbordcntrp {font-weight:bold;}
h1 { margin-top:1em; margin-bottom: 0;}
h2 {font-weight:normal; margin-top:0em; margin-bottom: 0.5em;}
h3 {margin-bottom: 0em;}
h3,h4,h5,h6 {font-weight:normal;margin-left: 0; }