前端必备知识点
1.初始化
*{
padding: 0;
margin: 0;
}
2.去掉ul ol 的点
ol,ul{list-style: none}
3.去掉a标签的下滑线
text-decoration: none
4.清除浮动
.clearfix:after{
content: '.';
clear:both;
display: block;
visibility: hidden;
height: 0;
}
5.盒子居中(必须是标准文档留下的谁盒子)
margin 0,auto;
6.文本居中
text-align:center
7.让绝对定位盒子居中
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <!-- <link rel="stylesheet" href="header.css"> <link rel="stylesheet" href="content.css"> --> <!-- <link rel="stylesheet" href="main.css"> --> <style> *{ padding: 0; margin: 0; } body{ font-size: 14px; } ul{ list-style: none; } a{ text-decoration: none; } input{ border: 0; outline: 0; } .father{ width: 100%; height: 200px; background-color: red; position: relative; } .box{ width: 400px; height: 100px; background-color: green; position: absolute; /*左右居中*/ left: 50%; margin-left: -200px;
/*上下居中*/ top:50%; margin-top: -50px; } </style> </head> <body> <div class="father"> <div class="box"></div> </div> </body> </html>
8.input输入框如果浮动不挨着了设置border:0
outline:none

浙公网安备 33010602011771号