CSS没有显示出来

时间:2011-08-11 04:45:50

标签: css html

我的外部样式表:

body {
margin: 0px;
padding: 0px;
background-color: #4d4d4d; }
 }


#reflection {
background-color: #fff;
background-repeat: no-repeat;
width: 100%;
height: 257px;
 }

#main {
border-top: 20px solid #494949;
margin-left: 0px;
margin-right: 0px;
margin-top: 90px;
height: 330px;
background-color: #eee;
 }

我的索引页

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<title>P.S.</title>
</head>
<body>
 <div id="main">
HERE'S THE MAIN PART!</div>
<div id="reflection">Here's the reflection.</div> </body>

div“反射”的css样式似乎没有出现。我不知道为什么。我已经在这里工作了几个小时!

7 个答案:

答案 0 :(得分:3)

body {
margin: 0px;
padding: 0px;
background-color: #4d4d4d; }
 }

请参阅上面的CSS。 2次关闭。请删除并检查它。 并且还错过了<html>

答案 1 :(得分:2)

来自http://www.ps.niu-niu.org/ps.css

.reflection {
background-color: #fff;
background-repeat: no-repeat;
width: 100%;
height: 257px;
 }

并从您的问题

#reflection {
background-color: #fff;
background-repeat: no-repeat;
width: 100%;
height: 257px;
background-image: url('http://www.ps.niu-niu.org/shine.png');
 }

更新服务器与您的问题相同的代码

答案 2 :(得分:1)

css文件格式错误.... }末尾有一个额外的body

body {
margin: 0px;
padding: 0px;
background-color: #4d4d4d; } /* extra bracket HERE */
}

答案 3 :(得分:1)

此处工作解决方案:http://jsfiddle.net/thilakar/yKX4v/1/

答案 4 :(得分:0)

您的reflection是个ID。你把它称为css中的一个类。

编辑:顺便说一下,这是关注实时视图。确保您已将更改实际应用到服务器。

答案 5 :(得分:0)

您在标记中也缺少<html>元素。

答案 6 :(得分:0)

<link type="text/css" rel="stylesheet" href="path/to/your/stylesheet.css>

中缺少<head>