search
HomeWeb Front-endHTML TutorialSolution: 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. . . . . .


Reply to the discussion (solution)

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

UBL...

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 UBL... Correct answer . . . www.seo7ye.com




Store List
Is it okay to write these things in the body? If I remember correctly, this should be written in the head

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.

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
What are boolean attributes in HTML? Give some examples.What are boolean attributes in HTML? Give some examples.Apr 25, 2025 am 12:01 AM

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values ​​need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

How can you validate your HTML code?How can you validate your HTML code?Apr 24, 2025 am 12:04 AM

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML vs. CSS and JavaScript: Comparing Web TechnologiesHTML vs. CSS and JavaScript: Comparing Web TechnologiesApr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version