margin是外边距
padding是内边距
都能调整与边框的距离,但是效果有时候并不一样
让div居中 写上margin:0 auto;就可以了
因为通配符选择器的权重低所有可以用来清除浏览器本身的内外边距,但也要注意代码的权重
*{
margin:0;
padding:0;
}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>快报</title>
<style>
*{
margin: 0;
padding: 0;
}
.box{
width: 248px;
height: 163px;
border: 1px solid #ccc;
margin: 100px auto;
}
.box h3{
height: 32px;
border-bottom: 1px dotted red;
font-size: 14px;
font-weight: 400;
line-height: 32px;
padd