Home >Web Front-end >HTML Tutorial >Please give me some advice, I am confused about setting the frame position_html/css_WEB-ITnose

Please give me some advice, I am confused about setting the frame position_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:22:231071browse

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:


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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn