DEV Community

Cover image for How to do stunning 3D with pure HTML/CSS

How to do stunning 3D with pure HTML/CSS

Martin PAUCOT on September 08, 2023

HTML and CSS may be the bedrock of 2D web design, but hidden within their virtual toolbox are the secrets to creating breathtaking 3D perspectives....
Collapse
 
jarvisscript profile image
Chris Jarvis

Wow, This is cool. Thanks for the perspective.

Collapse
 
emurrell profile image
Eric Murrell

I see what you did there 😆

Collapse
 
akinwunmi profile image
Jurrit van der Ploeg • Edited

Thank you for this great insight into the perspective utility 🔥
A next great step could be changing the shade of the faces based on their position on the X, Y and Z axis – something I will definitely dig into following up on this post!

Collapse
 
martinp profile image
Martin PAUCOT

I am really not a 3D expert but there is surely a mathematical way of calculating the correct shades for each side (and even using gradients)!
I would love to see that in action!

Collapse
 
zmzlois profile image
Lois

pure spitballing, maybe css custom properties can do this: developer.mozilla.org/en-US/docs/W...

Collapse
 
zmzlois profile image
Lois

Painting the web with code 🎉

Collapse
 
davboy profile image
Daithi O’Baoill

Very good 👍
Thanks

Collapse
 
martinp profile image
Martin PAUCOT

Thanks! I hope it gave you ideas!

Collapse
 
snappyclam profile image
Joseph Alan Wertz

TYVM Martin!

Collapse
 
martinp profile image
Martin PAUCOT

You are welcome!

Collapse
 
netheart profile image
Netheart technology

Hi

Collapse
 
martinp profile image
Martin PAUCOT

Hi! 👋

Collapse
 
the_riz profile image
Rich Winter

This works. But I would suggest you are using the wrong tool for the job. Swapping your divs for SVGs would be more appropriate than using an html DIVider. -
You can build a house out of toothpicks but it doesn't mean that you should.

Collapse
 
martinp profile image
Martin PAUCOT

Why would it be more appropriate? In this example I do not use any complex shapes so divs are completely fine imo. And to be honest, if you are looking to build 3D objects, HTML and CSS are the wrong tools.
But it is a way to discover more capabilities of the tools we use daily!

Collapse
 
artydev profile image
artydev • Edited

Great, thank you :-)
Look at this:
Amit Sheen Demos
Kevin

Collapse
 
martinp profile image
Martin PAUCOT

OH GOD, that's just impressive

Collapse
 
artydev profile image
artydev

En effet😉