littlegreiger Posted December 23, 2005 Share Posted December 23, 2005 I've added this to my css stylesheet which is included in all my webpages: center {text-align: center} It does what it's supposed to however when I go to the W3 Validator. It says "element "CENTER" undefined". Anyone know why this is? Link to comment Share on other sites More sharing options...
F-Man Posted December 23, 2005 Share Posted December 23, 2005 You're probably using a Strict DTD in which case presentation elements are unvalid. Give a class or ID to a div and center that div instead. .class { text-align: center;}or#id { text-align: center;} <div class="class"></div> or <div id="id"></div>A certain ID can only be used once in a page and should be used on medium-large chunks in your page. Classes are for multiple lesser-important elements on your page. Link to comment Share on other sites More sharing options...
littlegreiger Posted December 23, 2005 Author Share Posted December 23, 2005 Thanks. I just realized that I could do that. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 23, 2005 Share Posted December 23, 2005 if you where using <center> you wouldn't need to add the CSS. <center> is designed to center stuff on it's own. But yes is is depreciated in XHTML. Link to comment Share on other sites More sharing options...
~Shinta Posted December 24, 2005 Share Posted December 24, 2005 The fix is just <p style="text-align: center">Hello World.</p> Link to comment Share on other sites More sharing options...
littlegreiger Posted December 24, 2005 Author Share Posted December 24, 2005 Thanks guys. I got it figured out I just added .center {text-align: center} The <center> command works without css, but when validating the page it says that's incorrect. It would center the text but give me validation errors. Link to comment Share on other sites More sharing options...
Inita Posted December 26, 2005 Share Posted December 26, 2005 u can also write so :<center> <p>Im in center</p></center>But it strange, in <img> for eample, if im writiing 'valign="absmiddle"' - it works, but if im writing - 'style="vertical-align:absmiddle"' - it doesnt work. I meant, the picture isnt in the middle. 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