Negative top margin and border/background |
Negative top margin and border/background |
Christian J |
Apr 20 2011, 03:48 PM
Post
#1
|
. Group: WDG Moderators Posts: 9,630 Joined: 10-August 06 Member No.: 7 |
CODE <style type="text/css" media="screen"> h1 { width: 300px; height: 2em; margin: 0; color: black; background: pink; } p { width: 400px; margin: -3em 0 0 0; color: red; background: white; border: solid red; } </style> <h1>heading</h1> <p>lorem ipsum</p> In the above example the P background and border covers the H1 background, and the P text covers the H1 text, yet the H1 text covers the P background and border. Could someone explain the latter for me? |
pandy |
Apr 20 2011, 04:12 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,716 Joined: 9-August 06 Member No.: 6 |
In what browser can we see this? Are you sure it isn't an illusion because of the color choice? First I thought it looked the way you say (K-Mel), but when I enlarged the text it turned out not to be so.
|
Christian J |
Apr 20 2011, 05:27 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,630 Joined: 10-August 06 Member No.: 7 |
|
pandy |
Apr 20 2011, 06:12 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,716 Joined: 9-August 06 Member No.: 6 |
Sorry, I misread. I thought the heading text covered the paragraph text. I see what you see. Did you expect the P background to cover the heading text? I think that changed pretty long ago, but I'm not sure when. The oldest I have here apart from IE6 is O 9.24 and it does it as in your screen cap.
|
pandy |
Apr 20 2011, 06:20 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,716 Joined: 9-August 06 Member No.: 6 |
Found a K-Mel 1.1.2 based on Gecko 1.8.1.6. It does it the same way.
I think positioning brings back the old behaviour. |
Christian J |
Apr 20 2011, 07:08 PM
Post
#6
|
. Group: WDG Moderators Posts: 9,630 Joined: 10-August 06 Member No.: 7 |
Did you expect the P background to cover the heading text? Yes. This thread might be about the same thing: http://lists.w3.org/Archives/Public/www-st...09Feb/0222.html (though that example uses negative bottom margin on the first element instead). |
pandy |
Apr 20 2011, 08:24 PM
Post
#7
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,716 Joined: 9-August 06 Member No.: 6 |
Too tired to follow that, but I think it's about backgrounds always being behind foregrounds but only for static boxes.
|
Lo-Fi Version | Time is now: 28th March 2024 - 10:27 AM |