现在的位置: 首页 > 综合 > 正文

CSS样式表基础

2018年05月03日 ⁄ 综合 ⁄ 共 563字 ⁄ 字号 评论关闭

<!--样式表是对标签样式的修改-->
<!--当对标签的样式重复定义时,使用距离最近的样式定义-->

<!--在html中导入css样式表-->
<link REL=stylesheet href="Untitled-1.css" type="text/css">  <!--在head标签中添加这行-->

<!--标签的选择-->
h1{font-size:20pt;color:red}   <!--直接使用标签名-->
p.code{font-size:20pt;color:red}  <!--类选择符-->
p.comment{font-size:20pt;color:red}  <!--当p标签中class属性值为comment时,使用该样式-->
.code{font-size:20pt;color:red}   <!--对于任意标签,只要class属性值为code,使用该样式-->
#code1{font-size:20pt;color:red}  <!--ID选择符,只要id属性值为code1,使用该样式-->
H1,p{font-size:20pt;color:red}   <!--对h1和p标签定义样式-->
p a{font-size:16pt;color:green}   <!--对p标签中嵌套的a标签定义样式-->

抱歉!评论已关闭.