css - fixed header scrollable table with bootstrap -


how set each cell height max height of cell in row css only. want set height of each cell max height of cell in row existing code. don't want divs inside achieve this, css

html

<div class="panel panel-default">         <div class="panel-body">             <table id="mytable" class="table table-fixedheader table-bordered table-striped">                 <thead>                     <tr>                         <th width="15%">column1column1column1column1</th>                         <th width="15%">column2</th>                         <th width="15%">column3</th>                         <th width="15%">column4</th>                         <th width="40%">column5</th>                     </tr>                 </thead>                 <tbody style="height:110px">                     <tr>                         <td width="15%">aaaaaaaaaaa</td>                         <td width="15%">bbbbbbbbbbb</td>                         <td width="15%">ccccccccccc</td>                         <td width="15%">dddddddddddddddddddddddddddddddddddddddddd</td>                         <td width="40%">eeeeeeeeeee</td>                     </tr>                     <tr>                         <td width="15%">aaaaaaaaaaa</td>                         <td width="15%">bbbbbbbbbbb</td>                         <td width="15%">ccccccccccc</td>                         <td width="15%">ddddddddddd</td>                         <td width="40%">eeeeeeeeeee</td>                     </tr>                     <tr>                         <td width="15%">aaaaaaaaaaa</td>                         <td width="15%">bbbbbbbbbbb</td>                         <td width="15%">ccccccccccc</td>                         <td width="15%">ddddddddddd</td>                         <td width="40%">eeeeeeeeeee</td>                     </tr>                     <tr>                         <td width="15%">aaaaaaaaaaa</td>                         <td width="15%">bbbbbbbbbbb</td>                         <td width="15%">ccccccccccc</td>                         <td width="15%">ddddddddddd</td>                         <td width="40%">eeeeeeeeeee</td>                     </tr>                     <tr>                         <td width="15%">aaaaaaaaaaa</td>                         <td width="15%">bbbbbbbbbbb</td>                         <td width="15%">ccccccccccc</td>                         <td width="15%">ddddddddddd</td>                         <td width="40%">eeeeeeeeeee</td>                     </tr>                 </tbody>             </table>         </div>     </div> 

css

/* force table width 100% */  table.table-fixedheader {     width: 100%;    } /* set table elements block mode.  (normally inline). allows responsive table, such 1 columns can stacked if display narrow. */  table.table-fixedheader, table.table-fixedheader>thead, table.table-fixedheader>tbody, table.table-fixedheader>thead>tr, table.table-fixedheader>tbody>tr, table.table-fixedheader>thead>tr>th, table.table-fixedheader>tbody>td {     display: block; } table.table-fixedheader>thead>tr:after, table.table-fixedheader>tbody>tr:after {     content:' ';     display: block;     visibility: hidden;     clear: both; } /* when scrolling table, tbody portion of table scrolls (not entire table: want thead remain fixed).  must specify explicit height tbody.  include 100px default, can overridden elsewhere.  also, force scrollbar displayed usable width table contents doesn't change (such becoming narrower when scrollbar visible , wider when not). */  table.table-fixedheader>tbody {     overflow-y: scroll;     height: 100px;  } /* don't want scroll thead contents, want force scrollbar displayed anyway usable width of thead match tbody. */  table.table-fixedheader>thead {     overflow-y: scroll;     } /* browsers support (webkit), set background color of unneeded scrollbar in thead make invisible.  (setting visiblity: hidden defeats purpose, alters usable width of thead.) */  table.table-fixedheader>thead::-webkit-scrollbar {     background-color: inherit; }   table.table-fixedheader>thead>tr>th:after, table.table-fixedheader>tbody>tr>td:after {     content:' ';     display: table-cell;     visibility: hidden;     clear: both; }  /* want set <th> , <td> elements float left. must explicitly set width each column (both <th> , <td>).  set 20% here default placeholder, can overridden elsewhere. */   table.table-fixedheader>thead tr th, table.table-fixedheader>tbody tr td {     float: left;         word-wrap:break-word;      } 

check out fiddle


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -