New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css] 第58天 box-sizing常用的属性有哪些?分别有什么作用? #241
Labels
css
css
Comments
|
为了处理怪异盒子和标准盒子 |
|
补充一下,我记得老 Firefox 支持过 padding-box,后取消了。 |
border-box手机端写盒模型的时候很方便 |
默认属性
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.content {
height: 200px;
width: 200px;
background-color: cornsilk;
display: flex;
justify-content: center;
}
.inner {
height: 100px;
box-sizing: border-box;
width: 100px;
background-color: darkorange;
border: 10px darkseagreen solid;
/*设置10px内边距,你会发现盒子由原来的100ox变成了120px宽(左右各10padding),撑大了,
再加上上面的边框,整体大小变成了140px*/
padding: 10px;
}
</style>
</head>
<body>
<div class="content">
<div class="inner">100px的盒子</div>
</div>
</body>
</html> |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第58天 box-sizing常用的属性有哪些?分别有什么作用?
The text was updated successfully, but these errors were encountered: