css面试题学习笔记
- 盒子模型
标准:宽度=内容的宽度(content)+border+padding+margin
IE浏览起:宽度=内容宽度(content+border+padding)+margin
- css优先级算法如何运算
- 元素选择符:1
- calss选择符:10
- id选择符: 100
- 元素标签: 1000
- 居中一个div
position:absolate;width:200px;height:100px
-
- 浮动元素上下左右居中
flaot:left
left:50%
top:50%
margin: -50px 0 0 -100px
-
- 绝对定位
margin:0 auto
left: 0
right: 0
- position 的值
- static (默认)
- relative (相对定位) 参考自身
- absolute (绝对定位)参考距离最近的一个不为 staitc 的父级元素
- fixed (固定定位)
- css3 新特性
- 字体/盒子阴影:
text/box-shadow:5px 5px 5px #fff水平阴影 垂直阴影 模糊阴影 颜色
- 圆角:
border-radius:15px
- 单词换行:
word-wrop:break-word