1. rem, em是什么?
- em: 它是相对于当前对象内文本的字体尺寸,若没有设置行内文本的字体尺寸,则使用浏览器默认字体尺寸,一般为16px
- rem: 以根元素字体大小为单位
2. 有多少种盒模型
- IE盒模型: width = border + padding + 内容的宽度, height = border + padding + 内容的高度
- 标准盒模型: width = content的宽度, 设置盒模型方式 box-size: border-box(标准盒模型) | content-box(IE盒模型) | inherit(继承: 默认)
3. 定位的方式
- a. 相对于窗口定位 position: fixed
- b. 相对于父元素定位 父元素给属性 position: relative, 子元素给属性 position: absolute
- c. 相对于自身正常位置定位 position: relative, 再给top, right, bottom, left等属性时可以相对于自身正常位置做偏移
此文章为面试题收录, 我会持续更新, 若有错误欢迎指出, 若有好的建议也欢迎指出