Day04

2017-03-20  本文已影响0人  小白古

CSS的选择器与属性

属性

文字属性

规定文字样式的属性

font-style(fs)
font-weight(fw)
font-size(fz)注意:"px"
font-family(ff)注意:汉字要带引号------补充:设置备选字体(包括中英文分别设置字体)
补充:文字属性缩写(注意省略及顺序:size和family不能省略且要置于尾部)

文本属性

文本装饰属性

text-decoration:

line-through(tdl)
underline(tdu)
overline(tdo)
none(td)(常用于去掉a标签下划线)

文本水平对齐属性

text-align:

文本缩进属性

text-indent:2em;(ti2e)

颜色属性

color:值;

取值:

选择器

标签选择器

id选择器

先设id,再设属性

类选择器

先设类(class),再设属性

格式:
<标签名称 class="类名1 类名2 ...">
错误的写法:
<p class="para1" class="para2">

后代选择器

子元素选择器

交集选择器

并集选择器

兄弟选择器(同级关系)

相邻兄弟选择器(css2)
通用兄弟选择器(css3)

序选择器(个数选择器)--为css3新增的选择器中最具代表性

属性选择器

input[type=password]{}
<input type="text" name="" id="">
<input type="password" name="" id="">
上一篇下一篇

猜你喜欢

热点阅读