1.注释:
(1).HTML的注释:
(2).CSS的注释:/**
2.HTML中插入CSS(层叠样式表)的方法
(1).行内样式(在标签后面直接写样式)
<!doctypehtml>
<html>
<head>
<metacharset="utf-8">
<title>行内样式</title>
</head>
<body>
<pstyle="font-famliy:宋体;text-align:center;font-style:italic;text-transform:uppercase;font-size:22px;text-decoration:underline;font-weight:bold;letter-spacing:13px">html中插入css样式的方法:</br>1行内样式;2内部样式;<br/>3外部样式;4导入样式;</p>
</body>
</html>
(2)嵌入式(将样式和html语言分开写)
<!doctypehtml><html><head>
<metacharset="utf-8">
<title>行内样式</title>
<styletype="text/css">
p{text-decoration:underline;text-align:center;font-size:26px;font-family:宋体;font-weight:bolder;text-transform:lowercase;letter-spacing:4px;color:pink;background-color:green;}
</style></head><body>
<p>HTML中插入CSS样式的方法:</br>
1行内样式;2内部样式;<br/>
3外部样式;4导入样式;</p></body></html>
3.外部样式(链接式:将CSS和HTML分开写)!!!!最常用
first.html
<!doctypehtml><html><head>
<metacharset="utf-8">
<title>行内样式</title>
<linkhref="first.css"type="text/css"rel="stylesheet"></head><body>
<p>HTML中插入CSS样式的方法:</br>
1行内样式;2内部样式;<br/>
3外部样式;4导入样式;</p></body></html>
first.css
p{text-decoration:underline;/*加下划线*/
text-transform:lowercase;/*大写字母全部小写*/
text-align:center;/*居中*/
font-size:23px;/*字体大小*/
font-family:黑体;/*设置字体*/
font-style:italic;/*设置字倾斜*/
text-indent:3px;/*设置首行缩进*/
color:red;/*设置字体颜色*/
background-color:#ddd;/*设置背景颜色*/
letter-spacing:4px;}
4.导入式
first.html
<!doctypehtml><html><head>
<metacharset="utf-8">
<title>行内样式</title>
<styletype="text/css">
@importurl(first.css);</style></head><body>
<p>HTML中插入CSS样式的方法:</br>
1行内样式;2内部样式;<br/>
3外部样式;4导入样式;</p></body></html>
first.css
p{text-decoration:underline;/*加下划线*/
text-transform:lowercase;/*大写字母全部小写*/
text-align:center;/*居中*/
font-size:33px;/*字体大小*/
font-family:黑体;/*设置字体*/
font-style:italic;/*设置字倾斜*/
text-indent:3px;/*设置首行缩进*/
color:red;/*设置字体颜色*/
background-color:#ddd;/*设置背景颜色*/
letter-spacing:4px;}


本文转载自中文网

本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56849.shtml