我试图让div可滚动(这个div里面有一个表)并且在另一个div内(这个div有高度:100%)。这个小图片显示了我需要的结果。
这是我正在使用的代码,但如果你在图片中看到滚动没有显示。
#main-aside
{
padding-top: 5px;
padding-right: 5px;
}
.table-search {
margin:0 auto;
width: 440px;
height: 41px;
padding: 3px 4px 1px 4px;
background: #212020;
border-bottom: #000 1px solid;
}
#listEmployeeTable { // this is the div that contains the table, not working now
overflow-y: auto;
overflow-x: hidden;
}
.employee-table-column table{
width: 440px; // table have a width specified
}
<aside id="main-aside" class="x-east">
<div class="table-search">
<label>Search by name</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" class="form-control" id="searchEmployeList">
</div>
</div>
<div id="listEmployeeTable" class="employee-table-column">
<table class="table-striped employee-data-table">
<thead>
<tr>
<th class="name">Name</th>
<th class="time">Time</th>
<th class="action">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>NAME 1</td>
<td class="Time">04/12/2015 03:04 AM</td>
<td class="Action">Start after left</td>
</tr>
</tbody>
</table>
</div>
</aside>
目前这就是它的外观