1
Hello, I made an example table with three columns. I would like all three to start with 10%/70%/20% the original size of the table and only the middle column increased in size according to its contents (if it gets too big, the scroll x. However, if my column gets too long, it decreases the size of the other columns before activating this scroll. I wonder if you have any way to prevent the left and right columns from changing their size.
<!DOCTYPE html>
<html>
<head>
<title>Teste</title>
<style>
#dashboard {
width: 90%;
margin: 0 auto;
height: 400px;
border: 1px solid;
overflow-y: auto;
overflow-x: auto;
}
#table-dashboard {
width: 100%;
}
#table-dashboard td:first-child {
background: green;
width: 10%;
}
#table-dashboard td:nth-child(2) {
background: blue;
width: 70%;
}
#table-dashboard td:last-child {
background: red;
width: 20%;
}
</style>
</head>
<body>
<div id="dashboard">
<table id="table-dashboard">
<tr>
<td>1.</td>
<td>Batata</td>
<td>R$5,99</td>
</tr>
<tr>
<td>2.</td>
<td>Cenoura</td>
<td>R$1,50</td>
</tr>
<tr>
<td>3.</td>
<td>Tomate</td>
<td>R$3,00</td>
</tr>
</table>
</div>
</body>
</html>