Announcement

Collapse
No announcement yet.

XHTML+ Passing V3C Validator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    XHTML+ Passing V3C Validator

    Easy all, I'm building a few design templates and in XHTML(Basic DTD) and I've always used, just at the start of by <body> content:

    <div align="center">
    </div>

    Which makes everything in the div tag centered, like this site. But it's not supported by XHTML 1.0, so I've gotta do it in CSS. But what tag do I use to create the same effect?

    Thanks in advance!

    #2
    A Google search on CSS alignment came up with:

    Comment


      #3
      Well, in general, I tend to use "margin: 0 auto;" (0 top/bottom margin, auto left right) on a container div, and "text-align: left;" on that container, and "text-align: center;" on body element (for interent wanksplorer). That'll give you everything in your container div centered.

      Align is deprecated, basically, even more so than (ugh) <center>

      Comment


        #4
        What Paleface said:

        body {
        background: #ddd;
        margin: 0px;
        padding: 0px;
        text-align: center;
        }

        #container {
        position: relative;
        width: 700px;
        margin: 0px auto;
        text-align: left;
        }

        .content {
        float: left;
        width: 700px;
        margin: 0px;
        padding: 0px;
        background: #eee;
        border: 1px solid #000;
        }

        .content p {
        font-family: Verdana;
        color: #000;
        font-size: 11px;
        line-height: 15px;
        padding: 5px 0px 5px 5px;
        margin: 0px 0px 0px 0px;
        }
        ----------------------------------------------------------------
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
        <html>

        <head>
        <title>centered layout</title>
        <link rel="stylesheet" type="text/css" media="screen" href="style.css" />
        </head>

        <body>

        <div id="container">

        <div class="content">
        <p>all your stuff here</p>
        <p>etc etc</p>
        </div>

        </div>

        </body>
        </html>
        Last edited by Tetsuo; 17-10-2005, 15:59. Reason: try this .html and .css as a test page, should do the job!

        Comment

        Working...
        X