1.CSS 中的盒子模型
画出对应的content, margin, padding, and border 边界
2.元素 span, img, video 可以设置宽高吗?
span不可以,img和video可以
span 属于行内非替换元素不能设置宽高,img, video 属于行内替换元素,可以设置宽高
3.描述 CSS 层叠样式优先级
4.CSS 水平居中元素,CSS 垂直居中元素
具体:https://css-tricks.com/centering-css-complete-guide/
水平居中元素
1)
元素
2)
margin:0 auto;
3)
.father{
text-align:center;
}
.child{
display:inline-block;
}
4)
.flex-center {
display: flex;
justify-content: center;
}
垂直居中元素
1)单行文字垂直居中
使用padding,使用line-height
2)table中使用
vertical-align: middle;
5.页面有 5 个 div 元素,使用 for 遍历,实现点击对应的 div 时,分别 alert 出 div 内的文本内容
test
test1
test2
test3
test4
test5