我想在表格单元格中设置height:100%
实际上我想在表格单元格之间给出边距,这样我才能使用' .table-separator
'我使用保证金的表格的类,因为我不能在表格单元格中使用保证金但是.table-separator
'班级高度不是100%
'。我使用Bootstrap
。
这是当前条件:
但我想这样:
代码
CSS
.table-separator{
margin:0 10px 0 0;
height:100%;
}
.compare-table>thead{
border-bottom:none;
}
.compare-table>thead>tr>th:last-child .table-separator{
margin-right:0px;
}
.compare-table>thead>tr>th{
vertical-align:top;
padding:0;
width:25.2%;
border-bottom:0px;
}
.compare-table>thead>tr>th input{
font-weight:normal;
}
.compare-table>tbody>tr>th,
.compare-table>tbody>tr>td{
padding:0px;
border:0px;
height:inherit;
}
.compare-table>tbody .table-separator{
padding:8px;
border:1px solid #CDCDCD;
}
HTML代码
<table class="table compare-table" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th><div class="table-separator">
<div class="panel panel-default small-panel ns vonset2">
<div class="panel-heading small-heading">
<h3 class="text-normal text-uppercase no-m no-p">Rivals</h3>
</div>
<div class="panel-body">
<!-- rivals list -->
<ul class="list-unstyled row ps-row bordered-list rl">
<li class="col-xs-12"> <a href="javascript:;">
<div class="row ps-row">
<div class="col-xs-3 ps-col"><img src="http://cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s7--.jpg" width="" class="img-responsive"></div>
<div class="col-xs-9 ps-col flex">
<h2 class="no-m no-p fa-16 text-normal text-left text-capitalize">Samsung Galaxy J5 Compare With Samsung Galaxy J7</h2>
</div>
</div>
</a> </li>
<li class="col-xs-12"> <a href="javascript:;">
<div class="row ps-row">
<div class="col-xs-3 ps-col"><img src="http://cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s7--.jpg" class="img-responsive"></div>
<div class="col-xs-9 ps-col flex">
<h2 class="no-m no-p fa-16 text-normal text-left text-capitalize">Samsung Galaxy J5 Compare With Samsung Galaxy J7</h2>
</div>
</div>
</a> </li>
<li class="col-xs-12"> <a href="javascript:;">
<div class="row ps-row">
<div class="col-xs-3 ps-col"><img src="http://cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s7--.jpg" class="img-responsive"></div>
<div class="col-xs-9 ps-col flex">
<h2 class="no-m no-p fa-16 text-normal text-left text-capitalize">Samsung Galaxy J5 Compare With Samsung Galaxy J7</h2>
</div>
</div>
</a> </li>
</ul>
<!-- / rivals list -->
</div>
</div>
</div></th>
<th> <!-- compare with -->
<div class="table-separator">
<div class="panel panel-default small-panel ns vonset2">
<div class="panel-heading small-heading">
<h3 class="text-normal text-uppercase no-m no-p">Compare with</h3>
</div>
<div class="panel-body">
<form class="row pm-row relative voffset2 vonset2">
<div class="form-group col-xs-8 ps-col no-mb">
<input type="text" class="form-control" id="compare-search" placeholder="modal name or part of it...">
</div>
<div class="col-xs-4 ps-col">
<button type="submit" class="btn btn-primary col-xs-12">Search</button>
</div>
<div class="panel srch-sug hidden">
<div class="panel-body">
<div class="row pm-row bordered-col">
<div class="col-xs-12 pm-col">
<div class="pm-row row">
<h4 class="pm-col col-xs-12">Devices</h4>
</div>
<ul class="list-unstyled no-mb">
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
</ul>
<div class="pm-row row"> <a href="javascript:;">
<div class="pm-col col-xs-12 sug-footer more-result text-right"> More Reviews Results<i class="fa fa-arrow-circle-right pl5"></i> </div>
</a> </div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<!--/ compare with -->
<!-- comapre device -->
<div class="panel panel-default small-panel ns devic-panel">
<div class="panel-heading small-heading">
<h3 class="text-normal no-m no-p">Samsung Galaxy J7</h3>
</div>
<!-- device box -->
<div class="panel-body">
<ul class="list-unstyled no-mb row pm-row voffset2 vonset2">
<li class="col-xs-6 ps-col"><img class="img-responsive" src="http://cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s7--.jpg" width="137"></li>
<li class="col-xs-6 ps-col">
<ul class="list-unstyled dmenu">
<li><a href="">Review</a></li>
<li><a href="">Specs</a></li>
<li><a href="">Read Opinions</a></li>
<li><a href="">Pictures</a></li>
<li><a href="">360<sup>°</sup> View</a></li>
</ul>
</li>
</ul>
</div>
<!--/ device box -->
</div>
</div>
<!--/ compare device --> </th>
<th><!-- compare with -->
<div class="table-separator">
<div class="panel panel-default small-panel ns vonset2">
<div class="panel-heading small-heading">
<h3 class="text-normal text-uppercase no-m no-p">Compare with</h3>
</div>
<div class="panel-body">
<form class="row pm-row relative voffset2 vonset2">
<div class="form-group col-xs-8 ps-col no-mb">
<input type="text" class="form-control" id="compare-search" placeholder="modal name or part of it...">
</div>
<div class="col-xs-4 ps-col">
<button type="submit" class="btn btn-primary col-xs-12">Search</button>
</div>
<div class="panel srch-sug hidden">
<div class="panel-body">
<div class="row pm-row bordered-col">
<div class="col-xs-12 pm-col">
<div class="pm-row row">
<h4 class="pm-col col-xs-12">Devices</h4>
</div>
<ul class="list-unstyled no-mb">
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
</ul>
<div class="pm-row row"> <a href="javascript:;">
<div class="pm-col col-xs-12 sug-footer more-result text-right"> More Reviews Results<i class="fa fa-arrow-circle-right pl5"></i> </div>
</a> </div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<!--/ compare with -->
<!-- comapre device -->
<div class="panel panel-default small-panel ns devic-panel"> <a href="javascript:;">
<!-- Empty box -->
<div class="panel-body text-center text-muted"> <i class="fa fa-mobile voffset2"></i>
<p>Add a device to compare</p>
</div>
<!-- Empty box -->
</a> </div>
</div>
<!--/ compare device --> </th>
<th><!-- compare with -->
<div class="table-separator">
<div class="panel panel-default small-panel ns vonset2">
<div class="panel-heading small-heading">
<h3 class="text-normal text-uppercase no-m no-p">Compare with</h3>
</div>
<div class="panel-body">
<form class="row pm-row relative voffset2 vonset2">
<div class="form-group col-xs-8 ps-col no-mb">
<input type="text" class="form-control" id="compare-search" placeholder="modal name or part of it...">
</div>
<div class="col-xs-4 ps-col">
<button type="submit" class="btn btn-primary col-xs-12">Search</button>
</div>
<div class="panel srch-sug hidden">
<div class="panel-body">
<div class="row pm-row bordered-col">
<div class="col-xs-12 pm-col">
<div class="pm-row row">
<h4 class="pm-col col-xs-12">Devices</h4>
</div>
<ul class="list-unstyled no-mb">
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
<li class="media sug-list"> <a href="javascript:;">
<div class="media-left"><img class="media-object" src="http://placehold.it/68x83"></div>
<div class="media-body">
<h5 class="arimo media-heading">Samsung Galaxy J5</h5>
</div>
</a> </li>
</ul>
<div class="pm-row row"> <a href="javascript:;">
<div class="pm-col col-xs-12 sug-footer more-result text-right"> More Reviews Results<i class="fa fa-arrow-circle-right pl5"></i> </div>
</a> </div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<!--/ compare with -->
<!-- comapre device -->
<div class="panel panel-default small-panel ns devic-panel"> <a href="javascript:;">
<!-- Empty box -->
<div class="panel-body text-center text-muted"> <i class="fa fa-mobile voffset2"></i>
<p>Add a device to compare</p>
</div>
<!-- Empty box -->
</a> </div>
</div>
<!--/ compare device --> </th>
</tr>
</thead>
<tbody>
<tr>
<th><div class="table-separator main-heading">Cameras:</div></th>
</tr>
<tr>
<th><div class="table-separator">Camera:</div></th>
<td><div class="table-separator">16 megapixels</div></td>
<td><div class="table-separator">16 megapixels</div></td>
<td><div class="table-separator">9 megapixels</div></td>
</tr>
<tr>
<th><div class="table-separator">Flash:</div></th>
<td><div class="table-separator">LED</div></td>
<td><div class="table-separator">LED</div></td>
<td><div class="table-separator">N/A</div></td>
</tr>
<tr>
<th><div class="table-separator">Pxiel density:</div></th>
<td><div class="table-separator">518 ppi</div></td>
<td><div class="table-separator">518 ppi</div></td>
<td><div class="table-separator">222 ppi</div></td>
</tr>
<tr>
<th><div class="table-separator">Technology:</div></th>
<td><div class="table-separator">Super AMOLED</div></td>
<td><div class="table-separator">Super AMOLED</div></td>
<td><div class="table-separator">N/A</div></td>
</tr>
<tr>
<th><div class="table-separator">Screen-to-body ratio:</div></th>
<td><div class="table-separator">Super AMOLED</div></td>
<td><div class="table-separator">Super AMOLED</div></td>
<td><div class="table-separator">N/A</div></td>
</tr>
<tr>
<th><div class="table-separator">Dimensions:</div></th>
<td><div class="table-separator">186.9 x 108.8 x 8.7 mm (7.36 x 4.28 x 0.34 in)</div></td>
<td><div class="table-separator">186.9 x 108.8 x 8.7 mm (7.36 x 4.28 x 0.34 in)</div></td>
<td><div class="table-separator">186.9 x 108.8 x 8.7 mm (7.36 x 4.28 x 0.34 in)</div></td>
</tr>
<tr>
<th><div class="table-separator">Features:</div></th>
<td><div class="table-separator">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non tellus porta ante laoreet consequat.</div></td>
<td><div class="table-separator">Curabitur ut tellus maximus, ornare urna sed, rhoncus nulla. Donec viverra diam vehicula lectus tincidunt, a tincidunt urna tempor.</div></td>
<td><div class="table-separator">Sed fringilla molestie lectus. Integer euismod hendrerit tortor tempor auctor.</div></td>
</tr>
</tbody>
</table>
答案 0 :(得分:0)
更改CSS
.compare-table > tbody > tr > th, .compare-table > tbody > tr > td {
border: 1px solid #cdcdcd;
height: inherit;
padding: 0;
}
.compare-table > tbody .table-separator {
/* border: 1px solid #cdcdcd;*/
padding: 8px;
}
tr {
height: 100%;
}