记录CSS学习之路,通过w3cschool菜鸟教程学习,时间:2015/04/29
内容:
一:CSS基本语法
<!DOCTYPE html>
<html><head>
<style>
#paral{ /*使用ID标记, ID起名不能以数字开头火狐浏览器不起作用 */
color:red;
text-align:center;
}
</style>
</head>
<body>
<p id = "paral">
hello world!
</p>
<p>
this is astyled with CSS
</body>
</html>
二:.class用法
<style>
p.center{
color:red;
text-align:center;
}
</style>
<body>
<p class = "center">
hello world!
</p>
<h1 class = "center">
this is a styled with CSS
</h1>
</body>
此段代码由于class前有p,所以只控制p下class=“center”的样式,不对<h1>中起作用
类名的第一个字符不能使用数字!它无法在 Mozilla 或 Firefox 中起作用。