calc()此函数让你在声明CSS属性时执行一些计算 width:cala(100% - 80px); 可以用 + - * /
<style>
.father {
width: 300px;
height: 200px;
background-color: pink;
}
.son {
/* 永远比父盒子少30px */
width: calc(100% - 30px);
height: 30px;
background-color: skyblue;
}
</style>
<body>
<div class="father">
<div class="son"></div>
</div>
</body>