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語法:
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)頁