Designermonkey Posted August 30, 2006 Share Posted August 30, 2006 Not a happy bunny at the mo!I'm building a site that is using xhtml, tryin to fit the standards n all that, but I cant seem to align any tables or divs to the centre of my page so that when the browser window changes size, the table stays in the exact centre of the page....How the heck do I do this without the align="centre" attribute??This is gettin on my nerves now... Please will someone help me??John. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 31, 2006 Share Posted August 31, 2006 You need to use CSS. Instead of this:align="center" Do one of these, depending on the situation:style="text-align: center;" aligns the content inside of a containerstyle="margin: 0 auto;" aligns an object inside of it's parent container Link to comment Share on other sites More sharing options...
holmedwa04 Posted August 31, 2006 Share Posted August 31, 2006 You need to use CSS. Instead of this:align="center" Do one of these, depending on the situation:style="text-align: center;" aligns the content inside of a containerstyle="margin: 0 auto;" aligns an object inside of it's parent containerCant he just use <center>Text Blah blah blah</center> ? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 31, 2006 Share Posted August 31, 2006 Not in XHTML, center was deprecated. You can only use that in HTML 4.01 transitional. Link to comment Share on other sites More sharing options...
Just Me Posted December 1, 2007 Share Posted December 1, 2007 You need to use CSS. Instead of this:align="center" Do one of these, depending on the situation:style="text-align: center;" aligns the content inside of a containerstyle="margin: 0 auto;" aligns an object inside of it's parent containerHelloI am a beginner, too!I want only one div block in the body section and i want it with constant width (650px) and always in center.I tried many solutions in stylesheet and in html code and nothing works, including what you proposed!Help! It's driving me mad Link to comment Share on other sites More sharing options...
Ingolme Posted December 1, 2007 Share Posted December 1, 2007 HelloI am a beginner, too!I want only one div block in the body section and i want it with constant width (650px) and always in center.I tried many solutions in stylesheet and in html code and nothing works, including what you proposed!Help! It's driving me mad <body style="text-align: center"><div style="margin: 0 auto; width: 650px;">Content</div></body> Link to comment Share on other sites More sharing options...
croatiankid Posted December 1, 2007 Share Posted December 1, 2007 Not in XHTML, center was deprecated. You can only use that in HTML 4.01 transitional.You can use it in valid XHTML transitional as well. Link to comment Share on other sites More sharing options...
Just Me Posted December 1, 2007 Share Posted December 1, 2007 <body style="text-align: center"><div style="margin: 0 auto; width: 650px;">Content</div></body> It works!!!Many thanks to you Ingolme! I only did not try both commands. 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