css中的盒模型分為兩種稽亏,W3C的標(biāo)準(zhǔn)模型與IE的傳統(tǒng)模型:
一、W3C的標(biāo)準(zhǔn)盒模型
外盒尺寸:
1怎披、Element Height = content height + margin + padding + border
2、Element Width= content width+ margin + padding + border
內(nèi)盒尺寸:
1、Element Height= content height+ padding + border
2诬辈、Element Width = content width + padding + border
二、IE的傳統(tǒng)盒模型(IE6以下)
外盒尺寸:
1、Element Height = content height+margin (height包含了元素內(nèi)容高度悦穿,邊框高度知举,內(nèi)邊距高度)
2逛钻、Element Width= content width+margin (width包含了元素內(nèi)容寬度,邊框?qū)挾劝鸥牛瑑?nèi)邊距寬度)
內(nèi)盒尺寸:
1、Element Height = content height(height包含了元素內(nèi)容高度惩嘉,邊框高度罢洲,內(nèi)邊距高度)
2惹苗、Element Width= content width(width包含了元素內(nèi)容寬度耸峭,邊框?qū)挾缺咎椋瑑?nèi)邊距寬度)
box-sizing語(yǔ)法:
box-sizing:content-box || border-box || inherit
box-sizing:content-box 維持了W3C標(biāo)準(zhǔn)(默認(rèn)值)晦闰;
box-sizing:border-box維持了IE的標(biāo)準(zhǔn)舞竿;
?????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 內(nèi)容摘自部分網(wǎng)頁(yè)