标签:style blog http color 使用 strong 文件 io
CSS的语法规则主要有两个分构成选择器和声明(声明问一条或者多条)。
selector {declaration1; declaration2; ... declarationN }
选择器(selctor)是指你要改变样式的html元素。选择器有很多种,常用的id选择器和类选择器。
声明(declaration)是一个属性和一个值组成(要注意书写)。
属性(property)都有一个值,属性和其值用":"分开。
selector {property: value}
上面CSS代码的基本结构:
注:
p {font-family: "sans serif";}
p {
text-align: center;
color: black;
font-family: arial;
}
h1,h2,h3,h4,h5,h6 {
color: green;
}
body {
font-family: Verdana, sans-serif;
}
若body的子元素a中未定义属性font-family的声明,那么a将会继承他的父元素body的font-family的声明。
若body的子元素b中定义了属性font-family的声明,那么b的font-family属性覆盖它的父元素body的font-family的声明,从而达到摆脱父元素声明
CSS自学笔记(2):CSS语法,布布扣,bubuko.com
标签:style blog http color 使用 strong 文件 io
原文地址:http://www.cnblogs.com/lonzhe/p/3865931.html