DEV Community

Cover image for Creating beautiful HTML tables with CSS

Creating beautiful HTML tables with CSS

Dom (dcode) on July 20, 2020

It's easy to make your HTML tables look great - in today's post, we're gonna take a look at around 30 lines of CSS to do just that! Video...
Collapse
 
merri profile image
Vesa Piittinen • Edited

If you want your borders to look sharp on high resolution displays you can use thin instead of 1px :)

Update! This has apparently changed at some point and you only get regular 1px now (at least on iPhone). But you can use 0.5px instead to get the same effect.

Collapse
 
dcodeyt profile image
Dom (dcode)

Had no idea about this! Thanks 😊

Collapse
 
nombrekeff profile image
Keff

Nice, did not know about this! Will be using it for sure :)

Collapse
 
hyaovi profile image
Yaovi

I second you!

Collapse
 
cchana profile image
Charanjit Chana

Learn something new everyday!

Collapse
 
merri profile image
Vesa Piittinen

Hmm, now that I paid attention to it this doesn't seem to work anymore on iPhones :(

Collapse
 
shzcoders profile image
Shiraz Coders

Yeah, your right! Thanks🤔

Collapse
 
btlm profile image
btlm • Edited

I really love it. I'm bored of tons of bootstrap-like tables and your guide is such a refreshing approach

Collapse
 
dcodeyt profile image
Dom (dcode)

Appreciate that mate! Cheers

Collapse
 
hyaovi profile image
Yaovi

I agree with you! Bootstrap is all over the place (even tough i like it and use too)!

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
cchana profile image
Charanjit Chana

Hard to believe we once used tables to layout entire pages :)

Great example, was there any particular reason you used :nth-of-type instead of nth-child?

I would be interested to know how you would make this responsive if you had a few more columns or where the data is a little longer.

Collapse
 
raounek profile image
touibeg mohamed

beautiful css...

Collapse
 
brandonskerritt profile image
Autumn

Thanks for this! :)

Collapse
 
kalashin1 profile image
Kinanee Samson

I didn't like working with tables, maybe I'll consider them with this your post

Collapse
 
webdeasy profile image
webdeasy.de

Pretty 😊

Collapse
 
alexrodriguez2498 profile image
alexrodriguez2498

excelent article!, nice job.

Collapse
 
anthonygrear profile image
anthony-grear

I just went through a html lesson on tables, so I used your styling to go along with it. Thanks!

Collapse
 
denzeljoy_sugayan_7b7338 profile image
Denzel Joy Sugayan

what software does he used to code html?

Collapse
 
kilasuelika profile image
ZhouYao

I use your code in my website. Thank you so much.

Collapse
 
walters_michael_c19994afc profile image
Walters Michael

wow these is really nice

Collapse
 
gjangjeli profile image
Gjergji Angjeli • Edited

How can i change table with only

full width table head
Collapse
 
fahim_ullah_67 profile image
Fahim Ullah

Nice work

Collapse
 
michael_snabel_7ec927cec4 profile image
Michael Snabel

The header doesn't have radius like in the example image