盒子属性在行内非替换元素的特殊性
一、内容属性(width/height)-对行内非替换元素压根不起效果

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
background-color: #f00;
color: #fff;
font-weight: 700;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<span class="box">哈哈哈哈哈</span>
</body>
</html>
二、内边距(padding)- 上下会被撑起来,但不占空间

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
background-color: #f00;
color: #fff;
font-weight: 700;
width: 100px;
height: 100px;
padding: 50px;
}
</style>
</head>
<body>
<span class="box">哈哈哈哈哈</span>呵呵呵
<div>dddddd</div>
</body>
</html>
三、边框(border)- 上下会被撑起来,但不占空间

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
background-color: #f00;
color: #fff;
font-weight: 700;
width: 100px;
height: 100px;
border: 50px solid orange;
}
</style>
</head>
<body>
<span class="box">哈哈哈哈哈</span>呵呵呵
<div>dddddd</div>
</body>
</html>
四、外边距(margin)- 上下margin不生效

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
background-color: #f00;
color: #fff;
font-weight: 700;
width: 100px;
height: 100px;
margin: 50px;
}
</style>
</head>
<body>
<span class="box">哈哈哈哈哈</span>呵呵呵
<div>dddddd</div>
</body>
</html>
五、W3C这样制定的意义何在呢?
- 行内非替换元素是在段落里面的,如果给任何一个行内非替换元素添加border、margin这些会影响原来的结果,从而影响整体的美感