因此,基于以前的帮助,将margin: 0 auto
放在容器上并删除内容框上的所有边距属性在Mozilla Firefox中完美运行,但Internet Explorer是一场灾难。
它变得非常糟糕,以至于网站全都被打乱了。我想再试一次。
如何在Internet Explorer和Mozilla上集中内容框?
CSS代码:style_sample.css
该页面没有doctype
声明,例如:
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
因此,浏览器被抛入Internet 5.5 / Netscape / 1998兼容性/怪癖模式:
如果你添加<!doctype html>
声明把它扔进标准模式(我可以通过将浏览器更改为标准模式来模拟):
然后该页面对我来说很好。
Internet Explorer(Quirks模式):
IE浏览器:
铬: