css面经
1. 标准盒子模型和普通盒子模型的区别?
普通盒子模型,box-sizing: border-box, 设置的height/width 属性指的是 content + border + padding
标准盒子模型, box-sizing: content-box, 设置的 height、width 属性值得是 content
2. 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 比内联优先级高
原文地址:https://www.cnblogs.com/tdcqcrtd/p/17465015.html