centering page

Discussion in 'HTML' started by Bob, Apr 16, 2006.

  1. Bob

    Bob Guest

    How can I center the whole container in IE its is centered in firefox

    <?xml version="1.0" encoding="utf-8" ?>
    <!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" lang="en" xml:lang="en">
    <head>
    <title>Title</title>
    <style type="text/css">

    div {
    border: 1px solid #000000;
    }

    td {
    vertical-align: middle;
    text-align: center;
    }

    div.container {
    position: relative;
    margin: 0 auto;
    width: 770px;
    height: 600px;
    text-align: left;
    }

    div.left {
    position: absolute;
    top: 110px;
    left: 0px;
    width: 150px;
    height: 450px;
    }

    div.top {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 760px;
    height: 100px;
    text-align: center;
    }

    div.main {
    position: absolute;
    top: 110px;
    left: 150px;
    width: 610px;
    text-align: justify;
    height: 450px;
    }
    </style>

    </head>

    <body>
    <!-- ... body of document ... -->
    <div class="container">
    <div class="left">
    Left content
    </div>

    <div class="top">
    Top content
    </div>
    <div class="main">
    Main content
    </div>
    </div>

    </body>
    </html>
    Bob, Apr 16, 2006
    #1
    1. Advertising

  2. Bob

    Neredbojias Guest

    To further the education of mankind, "Bob" <null> vouchsafed:

    > How can I center the whole container in IE its is centered in firefox
    > ....(snip markup)


    I don't know, but I'll bet I'd find the answer easy with a url.

    --
    Neredbojias
    Infinity can have limits.
    Neredbojias, Apr 16, 2006
    #2
    1. Advertising

  3. Bob

    Els Guest

    Bob wrote:

    > How can I center the whole container in IE its is centered in firefox
    >
    > <?xml version="1.0" encoding="utf-8" ?>
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


    Take out the <?xml ... line and IE will be in Standards mode and it
    will center your page like it does in Firefox.
    That line throws it in Quirksmode. If you want to center it in
    Quirksmode, use old IE5 method for centering:
    http://locusmeus.com/html-css/centeringpage.html

    --
    Els http://locusmeus.com/
    Els, Apr 16, 2006
    #3
  4. Els wrote:

    > Bob wrote:
    >
    >> How can I center the whole container in IE its is centered in firefox
    >>
    >> <?xml version="1.0" encoding="utf-8" ?>
    >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    >
    > Take out the <?xml ... line and IE will be in Standards mode and it
    > will center your page like it does in Firefox.
    > That line throws it in Quirksmode. If you want to center it in
    > Quirksmode, use old IE5 method for centering:
    > http://locusmeus.com/html-css/centeringpage.html
    >


    you mean a line that has a rightful place in every *standard* XHTML document
    throws a browser into quirks mode ?! that makes no sence...

    --
    Thomas Jollans - http://jollybox.de/
    GNU/Linux - freedom, functionality, power - what more do you want ?
    When in doubt, follow the penguins.
    Thomas Jollans, Apr 16, 2006
    #4
  5. Bob

    Els Guest

    Thomas Jollans wrote:
    > Els wrote:
    >> Bob wrote:
    >>
    >>> How can I center the whole container in IE its is centered in firefox
    >>>
    >>> <?xml version="1.0" encoding="utf-8" ?>
    >>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    >>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    >>
    >> Take out the <?xml ... line and IE will be in Standards mode

    >
    > you mean a line that has a rightful place in every *standard* XHTML document
    > throws a browser into quirks mode ?! that makes no sence...


    I didn't say IE made sense ;-)

    --
    Els http://locusmeus.com/
    Els, Apr 16, 2006
    #5
  6. On Sun, 16 Apr 2006, Thomas Jollans wrote:

    > Els wrote:
    >
    > >> <?xml version="1.0" encoding="utf-8" ?>
    > >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    > >
    > > Take out the <?xml ... line and IE will be in Standards mode and it
    > > will center your page like it does in Firefox.
    > > That line throws it in Quirksmode. If you want to center it in
    > > Quirksmode, use old IE5 method for centering:
    > > http://locusmeus.com/html-css/centeringpage.html

    >
    > you mean a line that has a rightful place in every *standard* XHTML
    > document


    But (even if that were true), you're not sending *standard* XHTML when
    you send it as text/html; you're sending bad HTML, which just happens
    to resemble XHTML/1.0 subject to Appendix C, and relying on known
    browser (mis)behaviour to fix up the deliberate HTML errors.

    IE has no idea what to do with real XHTML (application/xhtml+xml).
    Well, I've taught my IE to pass real XHTML across to Seamonkey for
    rendering. Not ideal, but better than merely offering to download it.

    But the <?xml...> thingy is optional under certain circumstances, and
    the present situation (where utf-8 is used) is surely one of those
    circumstances.

    That's fine for utf-8; now see what it says in section C.1:

    http://www.w3.org/TR/2002/REC-xhtml1-20020801/#C_1

    - which is almost correct. But this sentence:

    |Remember, however, that when the XML declaration is not included in a
    |document, the document can only use the default character encodings
    |UTF-8 or UTF-16.

    is inaccurate, and incompatible with the explanation in section C.9:

    http://www.w3.org/TR/2002/REC-xhtml1-20020801/#C_9

    When sending via HTTP with a character encoding specified on the HTTP
    Content-type header, then the HTTP value takes precedence (as section
    C.9 rightly says), and there's no need to specify the encoding via the
    <?xml...> thingy. It doesn't /have/ to be utf-8 or utf-16. However,
    this can lead to problems when saving the page, unmodified, to file,
    and then attempting to browse it from file, by which time the HTTP
    character encoding specification has been lost.

    In short, it's safer to use utf-8 everywhere, rather than trying to
    use one of the 8-bit encodings (such as iso-8859-1 for Latin-1
    languages).

    > throws a browser into quirks mode ?! that makes no sence...


    IE does what it does. It's your choice whether to adjust to that, or
    just design for www-compatible browsers, and leave IE to its own
    non-conforming behaviour. In the current situation, the content *is*
    still accessible (unlike some of the other IE faults, e.g the peekaboo
    bug); a few cosmetic faults are only to be expected on a browser with
    such a notorious history of non-conformance to the www interworking
    specifications. Your choice, really.

    People are finally taking a deliberate decision about which browser to
    use, instead of just plugging along with the operating system
    component which came with their pee-cee. Maybe you want to author for
    discerning readers who were willing to make their own choice; maybe
    you want to author for the unthinking masses who know nothing more
    than "Open The Internet"; maybe you want to do your best for both - in
    the end, it's your choice; we can't tell you what to want.

    Personally, I'd recommend staying with HTML/4.01(strict) until it's
    feasible to deploy real XHTML and get any real benefits from it.
    XHTML/1.0 Appendix C brings essentially no benefits (since it was
    designed to be functionally identical to HTML/4.01, expressed in XHTML
    syntax), and several problems. Your internal process can perfectly
    well be XML-based if you want to use XML-based tools, but for general
    WWW purposes I would recommend publishing the result as valid
    HTML/4.01(strict).

    have fun
    Alan J. Flavell, Apr 16, 2006
    #6
  7. Bob

    Martin Jay Guest

    In message <4441bb3e$>, Bob <null@?.?.invalid> writes
    >How can I center the whole container in IE its is centered in firefox


    It appears to be centred okay here in IE6, however the layout is forced
    left in IE5.5.

    To fix that use:

    body{
    text-align: center;
    }

    This will centre everything in the document, so you will need to
    'text-align: left' things such as <p>.
    --
    Martin Jay
    Martin Jay, Apr 16, 2006
    #7
  8. Bob

    David Guest


    >>

    >
    > you mean a line that has a rightful place in every *standard* XHTML document
    > throws a browser into quirks mode ?! that makes no sence...
    >


    IE makes no sense! Another good reason for standards and why all
    browsers SHOULD follow them......
    David, Apr 16, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard

    Re: Centering image on page?

    Richard, Jun 25, 2003, in forum: HTML
    Replies:
    0
    Views:
    3,734
    Richard
    Jun 25, 2003
  2. Jerry Muelver

    Re: Centering image on page?

    Jerry Muelver, Jun 25, 2003, in forum: HTML
    Replies:
    0
    Views:
    827
    Jerry Muelver
    Jun 25, 2003
  3. martin weinberger

    Q: Centering flash on page

    martin weinberger, Sep 26, 2003, in forum: HTML
    Replies:
    6
    Views:
    2,551
  4. =?ISO-8859-1?Q?Fran=E7ois_de_Dardel?=

    Centering a page of thumbnails

    =?ISO-8859-1?Q?Fran=E7ois_de_Dardel?=, Apr 4, 2004, in forum: HTML
    Replies:
    11
    Views:
    667
    Marc Nadeau
    Apr 6, 2004
  5. Scott

    Centering whole page in CSS

    Scott, Jul 16, 2004, in forum: HTML
    Replies:
    3
    Views:
    4,811
Loading...

Share This Page