I need to center the content in XHTML 1.0 Strict. I have the following code: <body> <div style="border: 1px solid #336699; width: 700px;"> <table cellpadding="0" cellspacing="0" style="height: 340px; width: 700px;"> ... </table> </div> </body> Code (markup): Right now, this content is placed on the left side; I want to place this in the center. How can I do that? (BTW, http://www.cre8iveonline.com/charity/index.htm is where this website, which is work in progress, is hosted.)
You may want to use the margin:auto stlye property for the container div. <div style="border: 1px solid #336699; width: 700px;margin:auto"> Code (markup):
you can use the <center><p>content</p></center> HTML: but that is not recommended since it is depreciated, a cool trick i found (which works sometimes) is to use padding in the body with a fixed width div <body style="padding: 0 50px"> <div style="width: 800px; height: 600px"> <p>content</p> </div> </body> HTML: it may work?
<style type="text/css"> body { margin: 0 auto; text-align: center; } div { text-align: left; } </style> Code (markup): Place the above in the <head> section of your website.
Yes but there is still much love for <table> here. I use <div> for clients but i still retain the classic <table> in personal designs.
From the guy who first used tables for layout, Google for the article at XML.com "The Web Is Ruined and I Ruined It."
But after checking your layout it's ruined already your combining tables and bad div styling! That design of yours is using so many code which isnt needed at all. I would recode it from the psd file and learn css/html on the process because I think you just used photoshop to create this html.