Skip to content
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

盒模型【热度: 753】 #814

Open
yanlele opened this issue Aug 10, 2024 · 0 comments
Open

盒模型【热度: 753】 #814

yanlele opened this issue Aug 10, 2024 · 0 comments
Labels
CSS CSS 相关问题
Milestone

Comments

@yanlele
Copy link
Member

yanlele commented Aug 10, 2024

关键词:盒模型

盒模型

CSS3 中的盒模型有以下两种:标准盒子模型、IE 盒子模型

盒模型都是由四个部分组成的,分别是 margin、border、padding 和 content。

在标准盒模型性中

画板 (5)_看图王.png

盒子在网页中实际占用:
宽 = width + padding2 + border2 + margin2
高 = height + padding2 + border2 + margin2

盒模型实际大小:
宽 = width + padding2 + border2
高 = height + padding2 + border2

在 IE 盒模型性中

画板 (4)_看图王.png

盒子在网页中实际占用:
宽 = width + margin2
高 = height + margin2

盒模型实际大小:
宽 = width
高 = height

可以通过修改元素的 box-sizing 属性来改变元素的盒模型:

  • box-sizeing: content-box表示标准盒模型
  • box-sizeing: border-box表示 IE 盒模型
@yanlele yanlele added the CSS CSS 相关问题 label Aug 10, 2024
@yanlele yanlele added this to the milestone Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS CSS 相关问题
Projects
None yet
Development

No branches or pull requests

1 participant