Jump to content

How do I align div's and table's in xhtml??


Designermonkey

Recommended Posts

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

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

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
Cant he just use <center>Text Blah blah blah</center> ?
Link to comment
Share on other sites

  • 1 year later...
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
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 :)
Link to comment
Share on other sites

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

<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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...