DEV Community

Cover image for The Golden Ratio in CSS

The Golden Ratio in CSS

Mads Stoumann on September 25, 2024

The golden ratio, also called the golden number, golden proportion, or even the divine proportion, is a special relationship between two numbers th...
Collapse
 
rust_will_eat_the_world profile image
Nathan Stevens

Now THAT is interesting. I want more of this!
There's way too many listicles on this site.

Every day there's a dozen posts about top 20 tools to bring back your loved ones from the dead or something at the top of the lists.

Same rehashed stuff.

This is what I want more of.
And if there's a better place for things like this, please recommend. :)

Collapse
 
madsstoumann profile image
Mads Stoumann

Thank you! You can take a look at some of my earlier posts — recently, I wrote about the solar system and the periodic table in CSS grid.

Collapse
 
madsstoumann profile image
Mads Stoumann

This is without overflow:hidden — kinda beautiful!
Without overflow

Collapse
 
ezpieco profile image
Ezpie

Won't lie, this is better without over:hidden! This is kind of those things that look better by testing. Just like art in my opinion, you never know what would get cooked.

Collapse
 
madsstoumann profile image
Mads Stoumann

I like them both!

Collapse
 
drazenbebic profile image
Drazen Bebic

That is a very creative project, Love it!

This got me thinking: If you can find a way to maybe randomize patterns, streaks, colors, etc., you could programmatically create abstract art. Could also be using the HTML canvas tag instead of CSS. Not sure if something like this already exists?

Collapse
 
madsstoumann profile image
Mads Stoumann

Thank you! I have a work-in-progress project with svg-based art generators, here’s one of them: browser.style/art/bauhaus/

Collapse
 
juliannicholls profile image
Julian Nicholls

Nice!

Collapse
 
adewole_tobi_f04c0a02bee0 profile image
Adewole Tobi

It looks so beautiful 😍

Thread Thread
 
madsstoumann profile image
Mads Stoumann

Thank you!

Thread Thread
 
365team_fe_7099245ac388c8 profile image
365Team FE

Nice

Thread Thread
 
365team_fe_7099245ac388c8 profile image
365Team FE

Nice

Collapse
 
michaelthegamer profile image
Michael

What is even cooler is that the Golden Ratio Nautilus Effect (look up nautilus images to see what I mean), is that it is also seen in the human hand! Seriously, try it starting with the tip of your finger (usually index or middle work fine) and then measuring it to the next joint, and using a tape measure or even a ruler, measuring from fingertip to next joint then the previous joint to the next, to hand (well, wrist) and it goes to the shoulder. Think about it: another proof of order in what we are always told is random chaos. It's too much order. We are not random! Neither are we alone! Seek and you shall find!

Collapse
 
humblehumans profile image
Gregory Edgerton

Beautiful implementation! Working on a golden ratio project where i've been hung up on a li + :nth-child approach with relative widths while still leverage CSS grid. I couldn't see through the haze of my ideas.

Picked the project back up two days ago after an inspiring meet-up poised to dedicate an hour a day. Had yet to look what was out there though, finally waved the white flag in search of others. I find myself inspired again.

Thank you for sharing.

Collapse
 
madsstoumann profile image
Mads Stoumann

Thanks, happy to hear that! grid-area is the key here, at least for me, who like to “think in grids”.

Collapse
 
ricardogesteves profile image
Ricardo Esteves

Sooo cool this post/articles @madsstoumann. Was really nice to see your approach and how did you progress to the desired outcome!
There are so many interesting topics to experiment with, keep them coming!

Collapse
 
madsstoumann profile image
Mads Stoumann

Thank you so much — I have a bunch of geometric art generators coming up!

Collapse
 
likeatruckberserker profile image
Fiji

Great post! I’m also impressed by how well your colours are matching, did you use some online resource for palette generation or something?

Collapse
 
madsstoumann profile image
Mads Stoumann

I “stole” the colors from an old Bauhaus poster! 🫢

Collapse
 
michaelthegamer profile image
Michael

Hey, if it helps to enrich other people's lives, I think taking a little artistic license is, or at least should be, allowed. And with more than a few people commenting and complimenting on the colors alone, including all the other ones, I would say that you certainly did enrich many lives, mine included! Thx again!
(commented earlier, what is even cooler...)

MichaelTheGamer

Thread Thread
 
madsstoumann profile image
Mads Stoumann

Thank you so much! If you like the Bauhaus palette, I did an SVG version, where you can chose between various other Bauhaus-inspired color palettes:
browser.style/art/goldenratio/

Collapse
 
mince profile image
Mince

Awesome, 👍

Collapse
 
madsstoumann profile image
Mads Stoumann

Thanks!

Collapse
 
mannuelf profile image
Mannuel

very cool

Collapse
 
madsstoumann profile image
Mads Stoumann

Thanks!

Collapse
 
code_jedi profile image
Code_Jedi

Peak CSS creativity. Nice!

Collapse
 
madsstoumann profile image
Mads Stoumann

Thx!

Collapse
 
ali_raza_52ff666176c99648 profile image
Ali Raza

great

Collapse
 
madsstoumann profile image
Mads Stoumann

Thx!

Collapse
 
edchtzwe profile image
Ed

Noobs draw art on excel.
Pros draw art with CSS haha
Fascinating stuff you got there

Collapse
 
madsstoumann profile image
Mads Stoumann

Thank you! I’m just a former graphic designer who see grids everywhere 😂

Collapse
 
peter_bismuti_2719b24eb18 profile image
Peter Bismuti

There is a mathematician on YouTube who shows his process of using math to create images and it is a great example of how mathematicians can make great artists because they have so many tools at their disposal.

Thread Thread
 
madsstoumann profile image
Mads Stoumann

Cool, can you share a link?

Collapse
 
harryadney profile image
Martin Dimmock

Got to agree, this is great; maths + css! Colour me impressed.

Collapse
 
madsstoumann profile image
Mads Stoumann

Thx!

Collapse
 
racheldotstudio profile image
Rachel Wallis

This is so cool, love it!

Collapse
 
madsstoumann profile image
Mads Stoumann

Thx!

Collapse
 
n3storm profile image
Nestor Diaz Valencia

Beautiful

Collapse
 
madsstoumann profile image
Mads Stoumann

Thanks!

Collapse
 
annavi11arrea1 profile image
Anna Villarreal

I absolutely love this. Super clear, easy to follow, and it's just interesting. Thanks!

Collapse
 
madsstoumann profile image
Mads Stoumann

Happy to hear that — thanks!

Collapse
 
martinbaun profile image
Martin Baun

Brilliant move, respect!

Collapse
 
madsstoumann profile image
Mads Stoumann

Thank you!

Collapse
 
best_codes profile image
Best Codes

Love it! I like the Fibonacci sequence as well.

Collapse
 
madsstoumann profile image
Mads Stoumann

Thanks!

Collapse
 
aditya_075 profile image
Aditya Mhambrey

As someone starting out with web design, this article opened my eyes to a new world of possibilities. Bravo!

Collapse
 
madsstoumann profile image
Mads Stoumann

Nice! Thanks!