centering page

B

Bob

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>
 
N

Neredbojias

To further the education of mankind said:
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.
 
E

Els

Bob said:
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
 
T

Thomas Jollans

Els said:
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...
 
E

Els

Thomas said:
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 ;-)
 
A

Alan J. Flavell

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
 
M

Martin Jay

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>.
 
D

David

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top