|
Posted by Jonathan N. Little on November 21, 2007, 4:07 pm
Please log in for more thread options Roderik wrote:
> hzgt9b schreef:
>> Using CSS I want to center a DIV on the page and always keep it 3px
>> from the top. Seems simple but I cannot find a cross-browser solution
>> to this problem. I can get to work in IE or FF but not both w/o
>> relaxing the 3px from the top constraint. Can someone offer a solution
>> to this problem?
>>
>
> body {
> text-align: center;
> }
This is incorrect. text-align property aligns *text* not block elements.
To center a block element within its container set a width to the block
element and set the right and left margins to auto...
> #container {
> top: 3px;
> width: 700px;
> margin: 0 auto;
> text-align: left;
> }
The problem most likely is IE's 3-pixel bug and your solution relies on
quirks mode so it is unlikely to solve the problem
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
|