Jump to content
Designermonkey

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

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. :)

Share this post


Link to post
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

Share this post


Link to post
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> ?

Share this post


Link to post
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
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 :)

Share this post


Link to post
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>

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...