I'm having a little problem here. Well, I need to prevent the wrap of elements presents in a table, so I use white-space: nowrap;
. And here is the problem. The table is inside a div:
<div class='content'>
<table>
<!--Table elements goes here-->
</table>
</div>
In the CSS, I have:
div.content
{
background-color: #E6EBF2;
padding: 20px;
}
table
{
width: 100%;
margin-top: 20px;
border-collapse: collapse;
border-spacing:0;
background-color: white;
white-space: nowrap;
}
th, td
{
font-family: Arial, sans-serif;
font-size: 16px;
padding: 10px;
border-style: solid;
border-width: 1px;
border-color: #D6CECE;
overflow: hidden;
}
The problem is if the resolution of the screen is small than the table, the width of the div content
is not expanding according to table size, disfiguring the layout.
My result is something like:
But it needs to be like this:
Using display: inline-block
works, but I can't align the div on center. I apreciate any help, thanks!