我正在使用display:table做一個小的2窗格布局.對于間距(也來自背景圖像),我使用填充.因為我需要孩子們有一個確切的寬度:50%來自可用空間(考慮到父div的填充),我使用Box-sizing:border-Box.
這在Opera中運行良好,但在Chrome中,框大小:border-Box或甚至-webkit-Box-sizing:border-Box會被忽略.
我做了一個演示,顯示了這個問題.兩個紅色框應為方形,藍色框的寬度和高度應為200px:http://jsfiddle.net/fabb/JKECK/
這是html源代碼:
Something on the left side
Something on the right side
和CSS:
#table {
display: table;
/*border-collapse: collapse;*/
width: 200px !important;
height: 200px !important;
Box-sizing: border-Box;
-webkit-Box-sizing:border-Box;
-moz-Box-sizing:border-Box;
margin: 0;
border: 1px solid blue;
padding: 60px 20px;
}
#table #left,#table #right {
display: table-cell;
width: 50%;
Box-sizing: border-Box;
-webkit-Box-sizing:border-Box;
-moz-Box-sizing:border-Box;
margin: 0;
border: 1px solid red;
padding: 0;
}
這是Chrome中的錯誤嗎?或者我做錯了什么?