![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I figure should be easy, to have two DIV rows, 100% width, and then have three DIV columns underneath... I couldn't even get past the two rows. When I use absolute positioning, Firefox draws everything in the right place, but doesn't give me 100% width. Unlike IE. However if I remove the position property, Firefox does indeed draw the DIVS to the full width of the screen. |
|
Except, it also includes a white space at the top, like some kind of margin! I've tried to set all margins to 0px and padding to 0px, but still the white space on top remains - Unless I add a border, then it all draws in the correct places. Curiously, the differences between border 1px and border 0px seems to just move the box while any text inside stays at the same position on the screen. div id=banner1 <p>some text</p /div div id=banner2 <p>some text</p /div |
#3
| |||
| |||
|
|
You should always set a width for absolutely positioned elements. If you don't then, as you've seen, browser behaviour varies. But I doubt that you need absolute positioning at all. |
|
Curiously, the differences between border 1px and border 0px seems to just move the box while any text inside stays at the same position on the screen. div id=banner1 <p>some text</p /div div id=banner2 <p>some text</p /div The paragraphs have a default top margin. Under CSS margin collapsing rules this will collapse with the top margin of the parent div. So you end up with a margin above the div that is the larger of the margin set on the div (default zero) and the margin set on the paragraph (default about one line height). See http://www.w3.org/TR/CSS21/box.html#x25 To prevent margin collapsing the div needs a non-zero amount of either padding or border. Or you can remove the margin-top from the first paragraph via the :first-child selector (not supported by IE but as IE doesn't collpase margins properly not an issue). |
#4
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |