CSS - Mozilla bug?box-shadow:插图无法正常工作

bag*_*man 6 css firefox shadow

基本上下面的代码应该只是一个白色页面,边缘有阴影.这在Chrome中运行良好,但我似乎无法在Firefox中使用它!

<html>
<head>
<style type=text/css>
body {
background:#ffffff;
font-family:arial;
margin:auto;
box-shadow:inset 0px 0px 100px #333333;
-moz-box-shadow:inset 0px 0px 100px #333333;
-webkit-box-shadow:inset 0px 0px 100px #333333;
}
</style>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

在这里查看页面:

http://pastehtml.com/view/bagevr6ke.html

在Chrome和Firefox中查看它,告诉我你是否看到了区别:)

干杯

编辑:所以下面的帖子解释了如何修复上面的代码,CSS重置工作,我也学习了关于quirk模式和doctypes :)

然而,无论我使用什么重置,我正在处理的CSS页面仍然受到这个bug的影响.我目前没有使用Doctype,因为我不确定应该放什么,或者它是否会修复bug.

这是完整的网站:

http://middle.dyndns-server.com/results.html

和样式表:

body {
background:url('bg.png');
font-family:arial;
margin:auto;
box-shadow:inset 0px 0px 100px #333333;
-moz-box-shadow: inset 0px 0px 100px #333333;
-webkit-box-shadow:inset 0px 0px 100px #333333;
}

#footer {
padding-bottom:10px;
margin-top:30px;
}

#page {
width:960px;
height:auto;

background-color:#ffffff;
#background:url('bg2.png');

/*Space*/
padding-top:0px;
padding-bottom:0px;
padding-left:0px;
padding-right:0px;
margin-top:-10px;
margin-bottom:0px;
margin-left:auto;
margin-right:auto;

/*Shadow*/
-moz-box-shadow: 0px 0px 100px 0px #999999,inset 0 0 10px #000000;
-webkit-box-shadow: 0px 0px 100px 0px #999999,inset 0 0 10px #000000;
box-shadow: 0px 0px 100px 0px #999999,inset 0 0 10px #000000;

/*Border Radius*/
border-radius:0px 0px 20px 20px;
-moz-border-radius:0px 0px 20px 20px;
-webkit-border-radius:0px 0px 20px 20px;
-o-border-radius:0px 0px 20px 20px;

}

input[type=text] {
background: -webkit-gradient(linear,left top,right bottom,from(#333333),to(#666666));
        background: -moz-linear-gradient(top, #333333, #666666);
        filter: filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#666666'); 

border-width:1px;
border-style:solid;
border-color:#777777;
color:ffffff;
}

.line1 { 
float:left;
align:center; 
padding-bottom:0px;
}

hr { 
clear:left;
color:#111111;
}

/* The *normal* state styling */
.btn{
background-image:linear-gradient(90deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.2));
    background-image:-webkit-gradient(linear, 0% bottom, 0% top,color-stop(0%, rgba(51, 51, 51, 0.8)), color-stop(100%, rgba(0, 0, 0, 0.2)));
    background-image:-moz-linear-gradient(90deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.2));
    filter:progid:DXImageTransform.Microsoft.gradient(startColorStr='#80333333', EndColorStr='#20000000');
    -ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='#80333333', EndColorStr='#20000000')";
    background-color:rgb(51, 51, 51);
    border:1px solid rgb(0, 0, 0);
    border-radius:5px;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;
    padding:5px 10px;
box-shadow:0px 0px 6px rgb(130, 130, 130);
    -moz-box-shadow:0px 0px 6px rgb(130, 130, 130);
    -webkit-box-shadow:0px 0px 6px rgb(130, 130, 130);
    font-size:12px;
    font-weight:normal;
    color:rgb(255, 255, 255);
    text-shadow:0px 0px 1px rgb(255, 255, 255);
}
/* The *hover* state styling */
.btn:hover{
    background-image:linear-gradient(-90deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.2));
    background-image:-webkit-gradient(linear, left top, left bottom,color-stop(0%, rgba(51, 51, 51, 0.8)), color-stop(100%, rgba(0, 0, 0, 0.2)));
    background-image:-moz-linear-gradient(-90deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.2));
    box-shadow:0px 0px 6px rgb(0, 0, 0);
    -moz-box-shadow:0px 0px 6px rgb(0, 0, 0);
    -webkit-box-shadow:0px 0px 6px rgb(0, 0, 0);
}

/* The *active* state styling */
.btn:active,.btn:focus{
    background-image:linear-gradient(90deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.2));
    background-image:-webkit-gradient(linear, 0% bottom, 0% top,color-stop(0%, rgba(51, 51, 51, 0.8)), color-stop(100%, rgba(0, 0, 0, 0.2)));
    background-image:-moz-linear-gradient(90deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.2));
}

a {
font-family:arial;
outline:none;
text-decoration:none;
color:333333;
}

a:link {
text-decoration:none;
}

a:visited {
text-decoration:none;
}

a:active {
text-decoration:none;
color:ffffff;
}

a:hover {
text-decoration:none;
}
Run Code Online (Sandbox Code Playgroud)

我相信它不是很好,但我正在学习,这个问题现在是我的主要焦点:)

非常感谢.

thi*_*dot 3

添加这个:

html, body {
    height: 100%
}
Run Code Online (Sandbox Code Playgroud)

http://jsbin.com/oyuzug

中没有任何东西body,因此它没有高度。

它在 Chrome 中没有此功能的唯一原因是因为您没有将文档类型作为启用标准模式的第一行。

在 Chrome 中测试这些:

您的原始代码: http: //jsbin.com/urimah

您的原始代码与文档类型:http://jsbin.com/urimah/2

结论:始终将文档类型作为第一行,以避免怪异模式及其在不同浏览器之间带来的不一致。