box-sizing:border-box有什么作用
1 回答
已采納

kofzxaaa
TA貢獻(xiàn)66條經(jīng)驗(yàn) 獲得超26個(gè)贊
content-box:border和padding不計(jì)算入width之內(nèi)
padding-box:padding計(jì)算入width內(nèi)
border-box:border和padding計(jì)算入width之內(nèi)
??.content-box{ ????????box-sizing:content-box; ????????-moz-box-sizing:content-box; ????????width:?100px; ????????height:?100px; ????????padding:?20px; ????????border:?5px?solid?#E6A43F; ????????background:?blue; ????} ????.padding-box{ ????????box-sizing:padding-box; ????????-moz-box-sizing:padding-box; ????????width:?100px; ????????height:?100px; ????????padding:?20px; ????????border:?5px?solid?#186645; ????????background:?red;???????????????? ????} ????.border-box{ ????????box-sizing:border-box; ????????-moz-box-sizing:border-box; ????????width:?100px; ????????height:?100px; ????????padding:?20px; ????????border:?5px?solid?#3DA3EF; ????????background:?yellow; ????}
自行比較吧。
添加回答
舉報(bào)
0/150
提交
取消