Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72473

Create a HTML table without a fixed layout, with max-width set, and with rows that don't wrap but have overflow: hidden

$
0
0

Here's the starter code:

table {
  border: 1px solid black;
  max-width: 300px;
}

td:first-child {
  border-right: 1px solid black;
}

td {
    white-space: nowrap;
    overflow-x: hidden;
}
<table><tr><td>Lorem Ipsum is simply dummy text of the printing and typesetting industry</td><td>22</td></tr></table>

Further explanation:

I want to create a table that will calculate its columns' widths on its own, but have some max width. The catch is I can't have the text inside my td wrap, but it's fine if it's hidden with overflow property.

(If you haven't run the code: the table basically ignores the max-width)

Can this be done?


Viewing all articles
Browse latest Browse all 72473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>