使用HTML语言和CSS开发商业站点(4)

选择器:

标签选择器

p{
  background-color:purple;
}

类选择器

.one{
  color:red;
}

ID选择器

#a{
  font-size:25px;
}

 

行内样式:

<p style="color:blue;"> </p>

 

链接外部样式表,地址为one.css。
<link rel="stylesheet" type="text/css" href="one.css" />

 

导入外部样式表,地址为one.css。
<style>
  @import url("one.css");
</style>

 

后代选择器:

ol li{
}

 

并集选择器:

p,input,h1{
}

 

常用字体属性(设置字体类型、 大小、        风格、        粗细)。
                  font-family     font-size   font-style font-weight

 

常用文本属性(设置文本颜色、设置元素水平对齐方式、设置首行文本的缩进、设置文本的行高、设置文本的装饰)
                     color              text-align                text-indent          line-height        text-decoration

 

标签选择器:页面中的xx标签采用。。样式

class类选择器:不同标签可以使用同一个class值

id选择器:必须唯一 id号不能重复

优先级:id选择器 > class类选择器 > 标签选择器

 

优先级:行内样式 > 内部样式 > 外部样式

 

font-style:italic;/*斜体*/
font-weight:bold;/*加粗*/

text-align:center;/*文本水平居中*/

text-decoration:none;/*没有下划线*/

text-decoration:underline;/*有下划线*/

text-indent:20px;/*首行缩进20像素*/

 

posted on 2017-03-30 20:57  凌雨轩林  阅读(219)  评论(0编辑  收藏  举报

导航