When using display:table
and display:table-cell
, the border
of the table-cell
elements appear on top of the table
. How can I make sure the parent table
's border is on top?
I have a simple HTML layout:
<div class="section-header">General Properties</div>
<div id="policy-parameters">
<div class="parameter-row">
<label for="inputPolicyName" class="">Name</label>
<div class="parameter-entry">
<input type="text" class="" id="inputPolicyName">
</div>
</div>
<div class="parameter-row">
<label for="inputPolicyDescription" class="">Description</label>
<div class="parameter-entry">
<input type="text" class="" id="inputPolicyDescription">
</div>
</div>
</div>
Combined with a straight forward CSS:
#policy-parameters {
border: 1px solid #6c6c6c;
border-collapse: collapse;
display: table;
width: 100%; }
#policy-parameters .parameter-row {
display: table-row; }
#policy-parameters .parameter-row:not(:last-child) {
border-bottom: 1px solid #c4c2be; }
#policy-parameters .parameter-row label {
background-color: #deddd9;
border-right: 1px solid #c4c2be;
display: table-cell;
padding: 5px 3px 5px 7px;
width: 175px; }
#policy-parameters .parameter-row .parameter-entry {
background-color: #f7f6f5;
display: table-cell;
padding: 5px; }
#policy-parameters .parameter-row .parameter-entry input[type="text"] {
width: 400px; }
But when the table displays, I get the following result:
How can I make sure make sure the table
's border
appears on top of the table-cell
's border
?
UPDATE:
JSFiddle of the effect: http://jsfiddle.net/EvilClosetMonkey/8N7w2/
Note that the same effect is happening on the vertical label
's border-right
too.