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

描述一下css盒模型 #35

Open
sweetXiaoyan opened this issue Dec 28, 2019 · 0 comments
Open

描述一下css盒模型 #35

sweetXiaoyan opened this issue Dec 28, 2019 · 0 comments
Labels
css css以及css3相关内容

Comments

@sweetXiaoyan
Copy link
Contributor

sweetXiaoyan commented Dec 28, 2019

css盒模型

基本概念

就是来装页面上的元素的矩形区域。CSS中的盒子模型包括IE盒子模型和标准的W3C盒子模型。

  • 标准盒模型
    image

从上图可以看到标准 W3C 盒子模型的范围包括 margin、border、padding、content,并且 content 部分不包含其他部分。

  • IE盒子模型
    图片

从上图可以看到IE盒子模型的范围也包括 margin、border、padding、content, 与标准W3C盒子模型不同的是: IE盒子模型的content部分包含了 border 和 padding

在CSS3中引入了box-sizing属性,box-sizing:content-box;表示标准的盒子模型,box-sizing:border-box表示的是IE盒子模型

最后,前面我们还提到了,box-sizing:padding-box,这个属性值的宽度包含了左右padding+width

也很好理解性记忆,包含什么,width就从什么开始算起。

@koala-coding koala-coding added the css css以及css3相关内容 label Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css以及css3相关内容
Projects
None yet
Development

No branches or pull requests

2 participants