Hey, this is probably a very simple question for most of you super uber coders, and i feel stupid for asking this, but how do i center stuff in firefox? when i center stuff on my website it only centers for IE. =\ thanks.
Hey, this is probably a very simple question for most of you super uber coders, and i feel stupid for asking this, but how do i center stuff in firefox? when i center stuff on my website it only centers for IE. =\ thanks.
I don't think this is the 'proper' way, because <center> is depreciated.
But if you just:
Then you'll have a centered web page. You can also use css:HTML Code:<body> <center> ----content----- </center> </body>
HTML Code:style="text-align:center;"
The center element was deprecated in HTML 4.01.HTML Code:
<body>
<center>
----content-----
</center>
</body>
The center element is not supported in XHTML 1.0 Strict DTD.
The deprecation of the <center> element done in favour of CSS.
does not center the <div>. So i guess I'm with original poster here, how do you do it ?HTML Code:<body style="text-align:center;"> <div> ----content----- </div> </body>
The above code will do what you want.Code:<body> <div style="width:100%;"> <div style="text-align:center;"> This is a test </div> </div> </body>
Checked it with IE 7 and Firefox 2.0.0.1
You need to understand the difference. The <center> element does two things as seen from the perspective of CSS: it applies equal margins to both sides of the element and centres the text within that element.
will do the former (although this will not be noticeable unless you also apply a fixed width to the element, since by default block-level elements take up all available width.Code:<div style="margin: auto;">will do the latter, but not affect the position of the <div> itself.Code:<div style="text-align: center;">will apply both styles and make the <div> behave as if it were <center>.Code:<div style="text-align: center; margin: auto;">
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
As a simple attribute, you can just use:
<div align="center">
I'm pretty sure this is the same as <center>, so it would include both, but... not positive on that one.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
XHTML Transitional is based on HTML 4.01 Transitional, which in turn is based on HTML 3.2. Great care has been taken to avoid progress in each lest something break.
Just because it's valid Trans (of any format or version) doesn't necessarily mean it hasn't been deprecated in the real DOCTYPEs.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks