说明:纯属个人笔记,仅供参考
css:层叠样式表
作用:美化html
三种方式:行内式、内嵌式和外链式,行内式一般不推荐使用。还有一重要的特性:就近原则
行内式:<p style="color: darkgray;">css选择器</p>
<head>
<meta charset="UTF-8">
<title></title>
/*内嵌式*/
p{
color: coral;
font-size: 20px;
}
</style>
/*外链式*/
</head>
外链式为单独书写的一个css文件,内容类似内嵌式,但是没有内嵌式的外部标签<style>
如下:
/*标签选择器*/
p{
color: darkseagreen;font-family: "楷体";
font-weight: 200;
}
/*id选择器*/
#id{color: indianred;
font-size: 90px;
}
/*类选择器*/
.c1{color: initial;
font-size: larger;
}
/*派生选择器*/
p span{
}
/*伪类选择器*/
a:hover{
}
/*属性选择器*/
input [type="text"]{
}
/*分组选择器*/
h1,h2,h3,h4{
}