How to set width in a td
In a
<table>
, how do I set the first column's width to be by the <td>
's max content width?19 Replies
you mean that the text won't wrap in the first column?
max-content unfortunatly doesnt work on td's or th's. but you can prevent the text wrapping
if so, you could do
Why did I not think of that lol
could be shorter btw. that one was maybe a bit overkill for specificity
tr > :first-child
depends a bit on what you want/need. don't know if you have more tables, what's inside. if you have thead, tbody. if you use td/th....
but the white-space is what does the trick
It's an options page in a Chrome extension that is only used to display info
Now trying to figure out how to remove the bottom border from the last 2 cells
tr:last-child > td { border-bottom: none }
Noice
Any idea how to remove the gaps between the cell borders?
It's been a while since I messed with actual tables
border-collapse: collapse
on the tableNicely done
* I still knew ... but did you know there are online resources too? * 😉
"what css unit to use for td width"
lmao
in this case, you could have only gave the tr's a border bottom
I want to support both light and dark theme though
So I control the dark theme styling via a media query
Oh
I'll let you try yourself first. Learning how to use online resources is a skill too
As it turns out, I don't have to apply a white border as the
initial
's value turns to white
when the body's color is white
Don't worry, I've been doing it all day with other projects
Right now it's 1 AM so my brain's CPU clock is lowersame here, after midnight. this was the last discord check. You're my last 'customer' :p
lmao
Overall I'm happy with how the little page looks like
Though I should probably test on Firefox as well as it's a different beast