Reputation: 71
I want the table column width stays at 50% but resize the highlighted row like in the picture without affecting others.
I use
white-space: nowrap;
UPDATED
I solved the problem by this.
table.border-outline tr:nth-child(2) .table-share-row-even:nth-child(2) .data-column{
position: absolute;
white-space: nowrap;
right: -1px;
}
Upvotes: 0
Views: 3193
Reputation: 1422
HTML table behavior is fixed and very difficult to manipulate. You can read more about this here. This is why most people do NOT use table
tags to create a table, but instead make something called a div table - a table made out of div
tags. You can do what you are wanting using a div
table like this:
.div-table {
display: table;
width: 300px;
}
.div-table-row {
display: table-row;
background-color: #ccc;
}
.div-table-row:nth-child(even) {
background-color: white;
}
.div-table-col {
float: left;
display: table-column;
}
.div-table-col:nth-child(odd) {
width: 20%;
}
.div-table-col:nth-child(even) {
width: 80%;
text-align: right;
}
<div class="div-table">
<div class="div-table-row">
<div class="div-table-col">Share Series</div>
<div class="div-table-col">VEON ADS (NASD)</div>
</div>
<div class="div-table-row">
<div class="div-table-col">Time</div>
<div class="div-table-col">02/27/2019 16:00 (GMT-05:00)</div>
</div>
<div class="div-table-row">
<div class="div-table-col">Currency</div>
<div class="div-table-col">USD</div>
</div>
<div class="div-table-row">
<div class="div-table-col">Market</div>
<div class="div-table-col">NASDAQ</div>
</div>
<div class="div-table-row">
<div class="div-table-col">ISIN</div>
<div class="div-table-col">US91822M1062</div>
</div>
</div>
Upvotes: 2