1. CSS Selector priority
* 优先级就近原则,同权重情况下样式定义最近者为准; * 载入样式以最后载入的定位为准;
优先级为: 同权重: 内联样式表(标签内部)> 嵌入样式表(当前文件中)> 外部样式表(外部文件中)。 !important > id > class > tag !important 比 内联优先级高
标签的权重为1,class的权重为10,id的权重为100
2、CSS3新增了哪些特性
新增各种CSS选择器 (: not(.input):所有 class 不是“input”的节点)
圆角 (border-radius:8px)
多列布局 (multi-column layout)
阴影和反射 (Shadow\Reflect)
文字特效 (text-shadow、)
文字渲染 (Text-decoration)
线性渐变 (gradient)
旋转 (transform)
缩放,定位,倾斜,动画,多背景 例如:transform:\scale(0.85,0.90)\ translate(0px,-30px)\ skew(-9deg,0deg)\Animation:
3、为什么要清除浮动。清除浮动的方法有哪些
1.父元素的高度无法被撑开,影响与父元素同级的元素 2.与浮动元素同级的非浮动元素(内联元素)会跟随其后 3.若非第一个元素浮动,则该元素之前的元素也需要浮动,否则会影响页面显示的结构
Workaround:
1. Additional Labeling Method,<Div style= "clear:both;" ></div>/* Cons: But this approach adds extra tags to make the HTML structure look less concise. ) * /
2. Floating parent Element /* Excessive use of float is inconsistent with the essence of the Web * /
3. Set overflow to hidden or auto
4. Add a Clearfix class to the parent element
. Clearfix: After, . Clearfix: before{
content: " ";
display: table;
}
. Clearfix: After {
clear: both;
}
4, there are many, to be continued
CSS Knowledge points