css - How to make an html table deliberately exceed the width of its container? -
i'm trying make table contains horizontal scrollbar width of individual row can set whatever want. i've tried 2 different approaches achieve , each give me problems:
if assign width table larger containing div , apply overflow-x: scroll
, table exceeds width of container. however, have no control on width of cells. setting td{width:'x'px;}
doesn't anything.
if instead apply table-layout:fixed
table, can adjust width of individual rows cannot exceed width of table container.
how best of both worlds? need table exceed width of container in order scrollbar, while being able set width of different rows value.
html table , table cells work way design - cells confined within width of table. if want size them normal inline-block elements, can either:
- use
<div class="table">
,<div class="cell">
markup , style tables.
or
- change display mode in css.
{display: block}
tables,{display: inline-block}
cells. you'd need fiddle display modes of other elements<tr>
,<th>
,<thead>
,<tbody>
...
a little note: in case using tables means layout page content, please stop , reconsider changing approach. tables nasty crutch layout, , should used display actual tabular data.
Comments
Post a Comment