Search code examples
htmlcsscss-tablescss-multicolumn-layout

Style column-span seems not to work in tables


I want to avoid using colspan and rather go for CSS. In here it's suggested that I can use column-span. It's well-documented in many blogs etc.

However, entering it to my code, renders the td over one column only.

I also get a weird error message that e.g. 4 isn't a valid value for that style. I tried using all, which removed the warning but still didn't render as required.

I suspect that I'm missing something. Am I?


Solution

  • The column-span property is not intended for use in tables, but in DIVs that have a column-count setting. See an example here: https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_column-span

    Therefore it won't work in tables, also not in DIVs with table properties.