Home > Web Front-end > HTML Tutorial > Solution to DIV CSS website not being centered under IE8.0_html/css_WEB-ITnose

Solution to DIV CSS website not being centered under IE8.0_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:30:19
Original
1077 people have browsed it

Today a customer called and said that he updated his IE browser to IE8.0 and opened the website he just made and found that it was misaligned. It was clearly centered on the left, but Xiao Cai had encountered the same problem before. , so I'm not worried at all. Generally, writing DIV CSS has been basically tested with IE6.0, IE7.0 and Firefox. Because many people use it, no misalignment occurs. When I use IE8 to open the website, I find that the misalignment is very serious, including the homepage and list. Pages, article pages, etc. are all seriously misaligned.
I didn’t dare to use IE8.0 to open the website for the next two days. I really hope that not too many people are using IE8 now, and not too many people will find the website misalignment problem. Then I thought, escaping is not an option. After all, IE8 will only be used by more and more people, and it cannot be used by fewer and fewer people. I started researching the reasons and solutions for website misalignment under IE8.
Because the website used to be normal under IE7, and then it was misaligned under IE6, and it was normalized by changing the code. Then I thought, if it was misaligned under IE8, I should change the code to avoid the website misalignment. question. This can not but be said to be a troublesome matter. After all, it is a challenge for too many novice webmasters. In fact, it is not necessary. The IE8 browser itself has a very good function to solve the problem of website misalignment.

A solution on the client side

In fact, the solution is very simple. Use IE8 browser to open your website. If you find misalignment problems, please don’t panic. On the menu bar, open the "Tools" option, find "Compatibility View" in the drop-down menu, check it, and then check to see if the website is no longer misaligned.

The second website solves it by itself

IE8 has margin:0 auto; this CSS seems to be no longer useful, the page cannot be centered, I will come back in the afternoon and see if there is any way to center it, the front end of Pacific Ocean is also Said that their company ignored the existence of IE8 and the test was still the previous version.
The reason is found. I wrote margin:0 auto; in the body tag. It can be centered in IE7 and below, but not IE8. The solution is to write this code in a large div frame.

Baidu search information:

Program code


Method that works in all browsers:
 in What works in all browsers: What works in all browsers: What works in all browsers: <br>

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template