Open zxdfe opened 1 year ago
标准盒模型:width=content
设置:box-sizing:content-box
IE盒模型:width=content+padding+boder
设置:box-sizing:boder-box
IE盒模型这样设置,就是为了在设置内边距和边框的时候不会撑大盒子,一般默认的都是设置标准盒模型
标准盒模型: box-sizing:content-box width=content IE盒模型: box-sizing:border-box width=content+boder+padding
当对一个文档进行布局的时候,浏览器渲染引擎会根据标准之一的css基础盒模型把所有元素表示为一个个矩形的盒子 标准盒模型:实际宽/高度 = margin + border + padding + width/heigh IE盒模型:实际宽/高度 = margin + width/heigh 当使用 content-box 时:页面将采用标准模式来解析计算,这是默认模式, 当使用 border-box 时,页面将采用IE模式解析计算 当使用 inherit 时,页面从父元素继承 box-sizing 的值
1.标准盒子模型:宽度就等于内容的宽度
设置 box-sizing:content-box
2.IE盒子模型:宽度 = content + border + padding
设置 box-sizing:border-box
标准盒模型是有content+padding+border+margin; ie盒模型是width+magin 通过box-sizing:border-box可以将标准盒模型变成ie盒模型
标准盒模型:
width = content
box-sizing:content-box;
IE盒模型:
width=content+padding+border
boxsizing:border-box;
两者的区别在于:
怎么设置?
两者的区别在于:
怎么设置?
标准盒模型(W3C)
IE盒模型
width = content + padding + border
Box-sizing: border-box