View Full Version : In IE: centered, In Firefox: to the left
Haisook
04-03-2006, 04:32 PM
http://dr-haisook.blogspot.com/
My website is aligned to the center in Internet Explorer, while in Firefox it's aligned to the left.
I wonder: how can I center it in Firefox as well ?! :confused:
mwinter
04-03-2006, 07:47 PM
My website is aligned to the center in Internet Explorer, while in Firefox it's aligned to the left.That's because IE is broken, and it's using the text-align property - which, as it's name suggests, applies to text and other in-line content - to affect the position of block-level elements.
Block-level elements can be centred by applying a width or max-width property value other than auto, and setting auto left and right margins.
#container {
margin: 0 auto;
width: ??em;
}
Mike
Haisook
04-04-2006, 06:19 PM
Thanks Mike, but...
Where exactly should I put these codes? [You can view my source]
Sorry, I'm not that experienced with HTML codes.
mwinter
04-06-2006, 10:01 AM
To use what I posted, you'll first have to create a wrapper element, with the id attribute value, container (though you could change that, obviously):
<div id="container">
<!-- The content you want centred -->
</div>
It's then just a matter of adding the rule in my previous post to your existing style sheet. You'll obviously need to alter the value for the width property; a value of around 40-50em should be fine.
Hope that helps,
Mike
Haisook
04-08-2006, 12:05 PM
Thanks
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.