《精通CSS与HTML设计模式》读书笔记1——CSS选择符与继承

一、CSS选择符
1. 类型、类和ID选择符:element element.class element#ID
2. 群组选择符(group selector):用逗号
3. 后代选择符(descendent selector):用空格
4. 子选择符(child selector):用大于号
5. 首子选择符(first-child selector):用:first-child
6. 兄弟选择符(sibling selector):用加号
7. 属性选择符:p[title], p[title="paragraph"], p[title~="paragraph"]
8. 伪类元素选择符:element(*.class或者#ID):first-letter, element:first-line
9. 伪类选择符:a:link, a:visited, a:hover, a:hocus, a:active
10.子类选择符:<ELEMENT class="class subclass etc"> *.class.subclass.etc{SUBCLASS_STYLES}

二、继承
1. 不可继承的属性
以下属性可被所有元素继承:visibility和cursor。
以下属性会被内联元素继承:letter-spacing、word-spacing、white-space、line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、text-decoration、text-transforrn、direction
以下属性会被终端块状元素继承:text-indent和text-aligno
以下属性会被列表元素继承:list-style、list-style-type、list-style-position、list-style-image。
以下属性会被表格元素继承:border-collapse。
2. 不可继承的属性:
display、margin、border、padding、background、height、min-height、max-height、width、min-width、max-width、overflow、position、left、right、top、bottom、z-index、float、clear、table-layout、vertical-align、page-break-after、page-break-before和unicode-bidi。
3. 视觉继承的问题
为了应用视觉继承,你无需做任何事,因为background-color默认transparent(透明)并且background-image默认是none。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值