關(guān)于content-box元素的寬度和高度的計(jì)算,怎么沒有加上外邊距margin呢?是不是錯(cuò)了呢?
元素的寬度和高度(width/height)等于元素邊框?qū)挾龋╞order)加上元素內(nèi)距(padding)加上元素內(nèi)容寬度或高度(content width/ height),也就是element width/height = border + padding + content width / height
元素的寬度和高度(width/height)等于元素邊框?qū)挾龋╞order)加上元素內(nèi)距(padding)加上元素內(nèi)容寬度或高度(content width/ height),也就是element width/height = border + padding + content width / height
2015-07-22
舉報(bào)
2015-12-28
網(wǎng)頁盒子模型存在兩種:?
1:標(biāo)準(zhǔn)W3C盒子模型; 2:IE盒子模型(IE瀏覽器默認(rèn)的模型)。?
在兩種不同模型網(wǎng)頁里,定義了相同CSS屬性的元素顯示效果是不一樣的,下面就用公式來區(qū)分這兩種不同的盒子模型。?
1:標(biāo)準(zhǔn)W3C盒子模型?
寬=width+(padding-left)+(padding-right)+(margin-left)+(margin-right)+(border-left)+(border-right)?
高=height+(padding-top)+(padding-bottom)+(margin-top)+(margin-bottom)+(border-top)+(border-bottom)?
2: IE盒子模型?
寬=width+(border-left)+(border-right)?
高=height+(border-top)+(border-bottom)?
復(fù)制的前人的成果,希望能幫到你!