时间:2021-07-01 10:21:17 帮助过:42人阅读
想学好css,首先就是要学习手册

推荐学习CSS 在线手册。
学习完手册,接下来就可以学习实例教程

推荐学习CSS 0基础入门教程比较适合新手学习。
下面来看下学习步骤:
1.CSS规则。
伪类的语法:
selector:pseudo-class {property:value;}CSS类也可以使用伪类:
selector.class:pseudo-class {property:value;}http://www.gxlcms.com/css/css-pseudo-classes.html
2.CSS声明。
<html>
<head>
<meta charset="utf-8">
<title>Gxl网(php.cn)</title>
<style>
p
{
border-top-style:dotted;
border-right-style:solid;
border-bottom-style:dotted;
border-left-style:solid;
}
</style>
</head>
<body>
<p>两个不同的边界样式。</p>
</body>
</html>http://www.gxlcms.com/code/3213.html
3.值的不同写法和单位。
<html>
<head>
<meta charset="utf-8">
<title>Gxl网(php.cn)</title>
<style>
body {color:red;}
h1 {color:#00ff00;}
p.ex {color:rgb(0,0,255);}
</style>
</head>
<body>
<h1>这是标题</h1>
<p>这是一个普通的段落。请注意,本文是红色的。页面中定义的默认文本颜色选择器。</p>
<p class="ex">这是一段使用class选择器定义的p。这段文字是蓝色的。</p>
</body>
</html>http://www.gxlcms.com/code/3148.html
4.选择器的分组。
在样式表中有很多具有相同样式的元素,为了尽量减少代码,你可以使用分组选择器。每个选择器用逗号分隔。
<style>
h1,h2,p
{
color: #d4d223;
}
</style>http://www.gxlcms.com/code/3241.html
5.继承。
html {
font-family: sans-serif;
}
p {
line-height: 1.5;
}
/*
This rule is not needed ↷
p a {
line-height: 1.5;
}
*/http://www.gxlcms.com/css-tutorial-360263.html
6.派生选择器。
<html>
<head>
<meta charset="utf-8">
<title>Gxl网(php.cn)</title>
<style>
div p
{
background-color:yellow;
}
</style>
</head>
<body>
<div>
<p>段落 1。 在 div 中。</p>
<p>段落 2。 在 div 中。</p>
</div>
<p>段落 3。不在 div 中。</p>
<p>段落 4。不在 div 中。</p>
</body>
</html>http://www.gxlcms.com/code/3287.html
以上就是如何学习css?需要学习哪些知识点的详细内容,更多请关注Gxl网其它相关文章!