字体类型
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< title> 字体类型</ title>
< style>
#div1 {
font-family : Arial;
}
#div2 {
font-family : "Times New Roman" ;
}
#div3 {
font-family : "Heiti SC" ;
}
p {
font-family : Arial, Verdana, Georgia;
}
</ style>
</ head>
< body>
< div id = " div1" > Arial</ div>
< div id = " div2" > Times New Roman</ div>
< div id = " div3" > 黑体</ div>
< p> Rome was not built in a day.</ p>
</ body>
</ html>
字体大小
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< title> 字体大小</ title>
< style>
#p1 {
font-size : 10px;
}
#p2 {
font-size : 15px;
}
#p3 {
font-size : 20px;
}
</ style>
</ head>
< body>
< p id = " p1" > 字体大小为10px</ p>
< p id = " p2" > 字体大小为15px</ p>
< p id = " p3" > 字体大小为120px</ p>
</ body>
</ html>
字体粗细
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< title> 字体粗细</ title>
< style>
#p1 {
font-weight : 100;
}
#p2 {
font-weight : 400;
}
#p3 {
font-weight : 700;
}
#p4 {
font-weight : 900;
}
#p11 {
font-weight : lighter;
}
#p22 {
font-weight : normal;
}
#p33 {
font-weight : bold;
}
#p44 {
font-weight : bolder;
}
</ style>
</ head>
< body>
< p id = " p1" > 字体粗细为100(lighter)</ p>
< p id = " p2" > 字体粗细为400(normal)</ p>
< p id = " p3" > 字体粗细为700(bold)</ p>
< p id = " p4" > 字体粗细为900(bolder)</ p>
< br/>
< p id = " p11" > 字体粗细为lighter</ p>
< p id = " p22" > 字体粗细为normal</ p>
< p id = " p33" > 字体粗细为bold</ p>
< p id = " p44" > 字体粗细为bolder</ p>
</ body>
</ html>
字体风格
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< title> 字体风格</ title>
< style>
#p1 {
font-style : normal;
}
#p2 {
font-style : italic;
}
#p3 {
font-style : oblique;
}
</ style>
</ head>
< body>
< p id = " p1" > 字体风格为normal</ p>
< p id = " p2" > 字体风格为italic</ p>
< p id = " p3" > 字体风格为oblique</ p>
</ body>
</ html>
字体颜色
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< title> 字体颜色</ title>
< style>
#p1 {
color : gray;
}
#p2 {
color : orange;
}
#p3 {
color : red;
}
#p11 {
color : #03FCA1;
}
#p22 {
color : #048C02;
}
#p33 {
color : #CE0592;
}
</ style>
</ head>
< body>
< p id = " p1" > 字体颜色为灰色</ p>
< p id = " p2" > 字体颜色为橙色</ p>
< p id = " p3" > 字体颜色为红色</ p>
< p id = " p11" > 字体颜色为#03FCA1</ p>
< p id = " p22" > 字体颜色为#048C02</ p>
< p id = " p33" > 字体颜色为#CE0592</ p>
</ body>
</ html>
练习
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< title> Practice</ title>
< style>
#p1 {
font-family : Arial, Verdana, Georgia;
font-size : 14px;
font-weight : bold;
color : blue;
}
</ style>
</ head>
< body>
< p id = " p1" > 有规划的人生叫蓝图,没规划的人生叫拼图。</ p>
</ body>
</ html>