6月5号
1.Color属性定义文本的颜色
格式有:(1)Color:green
(2)Color:#ff6600–>简写为#f60(可以在ps颜色板中得到)
(3)红®,绿(G)蓝(B),格式:color:rgb(255,255,255) 取值是0~255
(4)透明度:color:rgba(255,0,0,0.8)(a取值在0~1间)a=0时字体和背景相容,看不到字体
2.字体属性:
font size(大小)
(1)px设置一个固定的值
(2)%:父元素百分比
(3)smaller:比父元素小
(4)larger:比父元素更大
(5)inherit:继承父元素的大小
如下:
body{
font-size:20px;
}<!--作为父元素-->
h1{font-size:100%;}
h2{font-size:200%;}
Font-family(定义字体)、
(1)格式:font-family:’微软雅黑’,’ serif’(意思是用微软雅黑字体,如果没有该字体则用serif)
font-weight字体加粗
(1)normal(默认)bold(粗)bolder(更粗)lighter(更细)
(2)400=normal,700=bold…
如下:
h1{
smaller;}
h2{
larger;}
h3{
font-size:100%;
font-weight:border}
h1{
font-family:'宋体','微软雅黑';
font-weight:normal;
}
h2{
font-weight:bold;
font-size:smaller;
}
font-style字体样式
(1)normal(标准)
(2)italic(斜体)
(3)oblique(倾斜)
(4)inherit(继承)
font-variant(小型大写字母显示文本)
(1)Normal
(2)Small-caps
(3)Inherit
如下列代码所示:
.a{font-style:normal; font-variant:normal;}
.b{font-style:oblique; font-variant:small-caps;}
.c{font-style:italic; font-variant:inherit;}
.d{font-style:inherit; font-variant}
<body>
<em class="a">maizixueyuan</em><br>
<em class="b">maizixueyuan</em><br>
<em class="c">maizixueyuan</em><br>
<em class="c">maizixueyuan</em><br>
</body>