Primal Posted April 14, 2007 Share Posted April 14, 2007 This is my CSS code. It's not showing up with any errors on the W3C validator, but it's not saying it's correct either. Anyone know why? body { background-color : #006000 ; color : #00EE00 }h1 { color : #00EE00 ; text-decoration : underline ; background-color : #006000 }hr { width : 65% ; color : #00CC00 ; background-color : #006000 }h1.center { margin-left : auto ; margin-right : auto ; text-align : center } Thanks,Primal Link to comment Share on other sites More sharing options...
boen_robot Posted April 14, 2007 Share Posted April 14, 2007 Well, I believe nothing is wrong. Your CSS is just perfect. No errors or warnings. Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted April 14, 2007 Share Posted April 14, 2007 Unless you forgot to post some more code, your code is valid with no errors or warnings.Here is a more optimized version to save space: body{background-color:#006000;color:#0E0}h1{color:#0E0;text-decoration:underline;background-color:#006000}hr{width:65%;color:#0C0;background-color:#006000}h1.center{margin:0 auto;text-align:center} Link to comment Share on other sites More sharing options...
real_illusions Posted April 14, 2007 Share Posted April 14, 2007 theres no semi-colon at the end of each line, it should be: body{background-color:#006000;color:#0E0;}h1{color:#0E0;text-decoration:underline;background-color:#006000;}hr{width:65%;color:#0C0;background-color:#006000;}h1.center{margin:0 auto;text-align:center;} but other than that, your css is pefect and should be valid. Link to comment Share on other sites More sharing options...
boen_robot Posted April 14, 2007 Share Posted April 14, 2007 Actually, the last semi-colon per selector is optional. It's only a good habbit to add it, but for better file size, it's better to remove it. Link to comment Share on other sites More sharing options...
croatiankid Posted April 15, 2007 Share Posted April 15, 2007 This is the smallest though: body{background:#006000;color:#0E0}h1{color:#0E0;text-decoration:underline;background:#006000}hr{width:65%;color:#0C0;background:#006000}h1.center{margin:0 auto;text-align:center} Link to comment Share on other sites More sharing options...
Primal Posted April 15, 2007 Author Share Posted April 15, 2007 What are these 3 digit Hex Codes? I have never seen this before. And what is this {margin:0 auto;text-align:center} ? I was told to do it the way I have it in order to trick older browsers, is this not true? Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted April 15, 2007 Share Posted April 15, 2007 CSS understand 3 digit HEX Codes... for example ABC is really AABBCC. So if you ever have 3 doubles you can shorten it down. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now