4 ms·
Is there a reason to use a CSS grid and not a <table>? Seems like web devs have been crying about a missing feature for a long time when it's already existed.
by Sohcahtoa82 7y ago
Is there a reason to use a CSS grid and not a <table>? Seems like web devs have been crying about a missing feature for a long time when it's already existed. But I only know the basics of web development and don't know best practices, so I don't know why devs would be insisting on using CSS to create a grid when an HTML table works just fine.
- keiwo 7y agoThe main reason is mobile responsiveness. With <table>, you need to conform to all the table related elements like <tr>, <td>, etc, which is fine on desktop. However when you want the table to collapse vertically instead of staying horizontal on mobile, trying to overwrite the browser defaults of these elements with CSS is a pain and not recommended. Using grid just makes it easier to change the display in CSS. You could argue that using CSS display:table works too, but display:grid just brings a lot of other niceties for controlling how you want the page to look.
- sureaboutthis 7y agoYou are correct but many decried the use of tables for layout as far back as 1999.
- sureaboutthis 7y agoTables are inflexible and inaccessible. Cells cannot be moved or resized without considerable effect on other cells. No developer worth his salt has ever used tables for layout since some time in the 2000s. The guy who first thought up such a thing, David Siegel, wrote an article in 1999 titled, "The Web is Dead and I Killed it" about how he killed the web because of it and regrets it all.