CSS选择器有哪些?哪些属性可以继承?

CSS选择符:

  id选择器(#myid)、

  类选择器(.myclassname)、

  标签选择器(div, h1, p)、

  相邻选择器(h1 + p)、

  子选择器(ul > li)、

  后代选择器(li a)、

  通配符选择器(*)、

  属性选择器(a[rel=”external”])、

  伪类选择器(a:hover, li:nth-child)

 

可继承的属性:font-size, font-family, color

不可继承的样式:border, padding, margin, width, height

 

优先级(就近原则):!important > [ id > class > tag ]
!important 比内联优先级高

posted @ 2020-04-17 18:08  YuTing-721  阅读(1548)  评论(0编辑  收藏  举报