Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css IE8中的最大宽度,宽度:100%?_Css - Fatal编程技术网

Css IE8中的最大宽度,宽度:100%?

Css IE8中的最大宽度,宽度:100%?,css,Css,我在网上搜索过,但我无法让它工作。 我有一个简单的html布局,我正在跨浏览器测试它。现在我知道IE总是有它的特点,所以我并不认为最大宽度CSS代码不起作用。虽然我不能使它工作,但我还是感到很惊讶。以下是我所拥有的: <style> div.test{ width:100%; max-width:650px; background-color:#333; } </style> <div class="test">This is a te

我在网上搜索过,但我无法让它工作。 我有一个简单的html布局,我正在跨浏览器测试它。现在我知道IE总是有它的特点,所以我并不认为最大宽度CSS代码不起作用。虽然我不能使它工作,但我还是感到很惊讶。以下是我所拥有的:

<style>
div.test{
    width:100%;
    max-width:650px;
    background-color:#333;
}
</style>
<div class="test">This is a test!</div>

分区测试{
宽度:100%;
最大宽度:650px;
背景色:#333;
}
这是一个考验!
这只会使测试div的宽度达到100%,即使它大于650px;。我正在IE8中测试这个。有人知道解决办法吗


谢谢。

您只是缺少了
宽度:100%
声明后的分号


很好用:)

嘿,谢谢你的回复!对不起,我忘了“;”在我的主题中,但不是在实际代码中。但它在IE8中仍然不起作用,您使用的是相同的浏览器和版本吗?我使用的是Windows7/IE9渲染,与IE7和IE8一样,它也适用于我。你的测试页面肯定没有其他事情发生,可能会有干扰?没有,当我只使用测试div上面的代码时,它的宽度一直比650px宽;另外,当我在“怪异”上尝试脚本时??这是我的测试文件,它在我的IE8渲染和netrenderer.com中工作:)非常感谢您的时间。添加标签修复了它…:)
div.test{
    width:100%;
    max-width:650px;
    background-color:#333;
}