Html table

| Am learning CSS atm, merged two of the header cells, but I want to change lengths of just one of the two columns. Is there a way?

| Drop.table

| I don't know but I would expect a div inside a cell would let you expand one.

| >>819295 it...works. I feel like there should be a better way to do this, but I'll take it for now. Thanks.

| Just use `width: []` on the cell's styling. A `width: 70%` on the first of the two cells in a row will ensure it takes up 70% of the total width, while the second cell takes the rest.

If you want to change the width of all the cells in that column, use a selector like this:

td:nth-child(1) {
width: 70%;

| >>819597 nth-child doesn't work because each row doesn't have the same amount of cells, so it ends up affecting other columns.

| >each row doesn't have the same amount of cells
They... don't? What do you mean by "column" then? HTML doesn't actually understand the concept of a "column". It's just rows with cells in it.

You can use a class on the weirdly-sized cells, I guess?

Honestly if your table's kinda funky, I'd suggest using grid or flexbox instead. HTML's table is kind of a relic at this point.

| >>819741 they do tho? I set colspan on one of the header cells to two.

| >>819750
...? Oh you mean about HTML understanding the concept of column. Huh. Yeah, I guess they do. They're just not elements on their own, so you can't style them the same way.

Maybe you can use colgroup? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup

Then again I'm not really sure what you want. I guess some rows have cells with a set colspan and some don't?

| (Also gotta add that I've been a web developer for over ten years and I've never used colgroup. It's a weird piece of web standard)

| >>819763 ye to your second question.
I forgot colgroup existed lmao. Thanks, now the code looks right, though I guess this shows that html tables really are becoming archaic, aren't they.

| Separate question from op: are html tables still used? I keep hearing to stop using them but alternatives I've found are just making manually with divs? Is that accessibility friendly?

| >>820552
Tables can still be used if you're actually showing data and statistics and the likes.

Absolutely do not use it for layouting purpose. Like, don't use it to make an image gallery. Grid and flexbox exists.

Total number of posts: 13, last modified on: Wed Jan 1 00:00:00 1641295186

This thread is closed.