IE的body宽度不工作 [英] IE body width not working

查看:128
本文介绍了IE的body宽度不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的body元素设置为840px,然后边距auto:

I have the body element set to 840px and then margins auto:

body {
width: 840px;
margin: auto;
}

在FF,safari和chrome 。但是在IE(目前在IE9测试),我的所有div都设置为100%仍然扩展到屏幕的整个宽度。在开发工具中,它仍然说,本体具有宽度840,但它不会压缩其余的元素。

on FF, safari, and chrome this centers everything in the body of my site. However on IE (testing in IE9 currently) all of my divs that are set to 100% still expand to the whole width of the screen. In dev tools it still says that the body has width 840 but it does not constrict the rest of the elements.

这里做什么?

推荐答案

使用有效的doctype like< ;!DOCTYPE HTML>

Use valid doctype like <!DOCTYPE HTML>

<!DOCTYPE HTML>
<style>
body {
margin: 0 auto;
width: 1000px;
}
</style>

<body>
SALALALLA
</body>

这篇关于IE的body宽度不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆