为什么这个工作:CSS,为什么一件事情可以工作,而不是另一件事情?
<div style="background-color: #ccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #000;
padding: 10px;">testing 10,9,8,7
</div>
这不?
<div style="roundedCornerBox">
testing 10,9,8,7
</div>
当我创建了一个CSS文件,上面写着:
body {
background-color: #FFFFFF;
text-align: center;
}
roundedCornerBox {
background-color: #ccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #000;
padding: 10px;
}
这里是我的HTML代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title></title>
<link rel="stylesheet" href="lib/css/style.css" />
</head>
<body>
<div style="roundedCornerBox">
testing 10,9,8,7
</div>
<div style="background-color: #ccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #000;
padding: 10px;">
testing 10,9,8,7
</div>
</body>
</html>
http://www.w3.org/TR/REC-html40/present/styles.html#adef-style 样式属性的定义。 较少的技术和再次有用的w3schools细分的差异:http://www.w3schools.com/CSS/css_howto.asp – Kzqai 2010-03-01 23:50:46