Home>Article>Web Front-end> Example of a solution for using margin:0 auto in HTML to prevent the entire page from being centered

Example of a solution for using margin:0 auto in HTML to prevent the entire page from being centered

高洛峰
高洛峰 Original
2017-03-06 16:09:20 2445browse

Today I am writing a jsp page, and I have to adjust the

123xxx
no matter how I change this attribute, I can't get the page to be displayed in the center, and other styles also appear inexplicably. Problem

Later I found a solution to this problem:

It turns out that L-Blog does not add DTD before HTML by default, so IE interprets the document as HTML instead of XHTML.
The problem is not in the CSS but in the XHTML web page itself.
You need to add this code to make the above settings effective:


      

If you want a more strict XHTML 1.0 Strict or XHTML 1.1, please check Related documents.
The above tests are based on Windows XP SP2 version IE6 and FireFox 1.0 final version.

It is recommended that if you need to use css style in the page, do not delete this line:


      

Update For example, when using margin:0 auto in multiple html, the entire page is not centered. For related articles, please pay attention to the PHP Chinese website!

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