Home >Web Front-end >HTML Tutorial >Solution: There is a blank space at the top of the html page_html/css_WEB-ITnose
1. The character encoding of the html file has been changed to utf-8 and boom format; 2. The css code is also pinned to the top, but there is still a blank space at the top? ? ! ! Ask the experts for answers. . . . . .
Describe in detail and post the code.
* {margin:0px;padding:0px;}
Use chrome’s developer tools to take a look
Open the html as a text file and save it
Open the html with a text file and save it
I tried it, but it’s not a character encoding problem; I converted it to UTF-8 and removed the BOM format. . .
The original poster is lucky. I discovered it after spending time testing the code block by block. At that time, I couldn't even find the same problem online.
You put
modified to
It should be fine
The original poster is lucky. I discovered it after spending time testing the code block by block. At that time, I couldn't even find the same problem online.
You put
modified to
I have tried all three document declarations, but it still doesn't work. . . .
My other page header document declarations also use
, all are normal. . . .
Looking for answers? ? ? ? ?
Is this the problem href="{res file=css/store_mall.css}"
Try this
href="css/store_mall.css"
Yes This is the problem href="{res file=css/store_mall.css}"
Try this
href="css/store_mall.css"
No, the css address is dynamic , you can only see the absolute path of css after displaying it at the front desk
Save utf-8 with BOM as utf-8 without BOM
... Uh, I didn’t see it clearly
If There is no BOM, mostly caused by the background program outputting the header before outputting the HTML
Save UTF-8 with BOM as UTF-8 without BOM
Why do I run it with Chrome? Is there no blank space? ? ? ? I can run it
Try setting margin-top to a negative number
If the "Special Notes" of these attributes are not the problem, then it is an error written by the author himself.
Either the HTML CSS is written incorrectly, the tag pairs and levels do not match well, or JS/CSS is incompatible.
I said that when I first processed it, I deleted and tested it piece by piece. It was actually quite fast to find it this way. I sorted out the big ones first and then the small ones.
The problem that cannot be solved is the basic experience of the original poster.
Others haven’t even seen your entire code, so how do they know what it will be? They can only guess.
Standard issue! Please carefully check the logic in your page to see if it is written in a standardized way...
body{ margin:0px; }
You can use
I also encountered this problem and don’t know how to solve it
Caused! Try not to use dynamic ones!
It feels like the format is not standardized, try formatting it
Which IE are you using? Is it a problem with IE's double margins?
CSS plus * { margin: 0px; padding: 0px; } or body { margin: 0px; padding: 0px; }
*{margin:0;padding:0;}
It seems that I have also encountered this problem of the original poster. Don’t use margin for the div inside, use padding instead. This seems to be a margin merging problem in CSS.
Use chrome to debug, it is easy to find the problem.
I have encountered this problem before. It is an encoding problem of the web page source code. If the encoding is incorrect, this problem will occur. For example, the source program encoding is in utf8 format, and the style file is in gb2312 format, which will cause this problem. Condition.
Another point is that the utf8 format is divided into two formats: utf-8 unsigned and utf8-signed. They must be consistent, otherwise exceptions will occur. Hope it is useful to everyone.
Owner I have the same problem as you
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
This is the solution.
Add this in CSS.