This post was last edited by kakasiee on 2013-07-07 15:10:54
HTML CSS
HTML1:
Cascading Style Sheets
CS1:
h1
{
position:absolute;
top:0px;
left:0px;
width:100%;
background- color:#666666;
padding-top:10px;
padding-left:5px;
padding-bottom:30px;
color:#ffffff;
}
The style is as shown in Figure 1:
HTML2:
Cascading Style Sheets
CSS2:
div
{
position:absolute;
top:0px;
left:0px;
width:100%;
background-color:#666666;
padding-top :10px;
padding-left:5px;
padding-bottom:30px;
color:#ffffff;
}
The style is as shown in Figure 2:
also sets
position:absolute;
top:0px;
left:0px;
Why can the second one be flush with the web page, but the first one leaves a blank space? Woolen cloth?
Please give me some advice
Reply to the discussion (solution)
Then I tried it in chrome, it was the first case, and then I added margin-top:0px That’s OK again. It's really a headache to be compatible with different browsers.