/    Sign up×
Community /Pin to ProfileBookmark

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%; }

[url]www.gordonengraving.co.uk[/url]

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@pointfiftyaeSep 19.2005 — 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.
Copy linkTweet thisAlerts:
@FangSep 19.2005 — 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.

.[I]tbordcntrp[/I] is applied to an inline element, so [I]text-align[/I] will not work.
Copy linkTweet thisAlerts:
@FangSep 21.2005 — The errors you show can not have come from the W3C validator. [URL=http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http%3A//www.gordonengraving.co.uk/]validator errors[/URL]

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; }
×

Success!

Help @chesswill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...