Centred DIV
Shows how to center a DIV in both browsers (Firefox and IE)
<!------> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>example page</title> <style type="text/css" media="all"> body { background-color: #ffffff; /* for IE: */ text-align: center; } #page { background: #eeeeee; /* for firefox, etc: */ margin-left: auto; margin-right: auto; text-align: left; width: 70%; } </style> </head> <body> <div id="page"> <h1>Title</h1> <p> This content should be centered :-) </p> </div> </body> </html>
See below
Sorry folks, comments have been deactivated for now due to the large amount of spam.
Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!
Older comments:
None.