This is the kinda stuff we're gonna make today!
How make these shapes (using linear gradients as example)
Getting the gradients right
These shapes use four linear gradients. that all have the same volume.
I define them as percentages, here with a ratio of 1:9.
With the help of the keywords 'top left', 'top right', 'bottom left', and 'bottom right' it was easy to anker them to the edges of their squares.
Just gotta combine it all in one class! (Also making sure these things don't repeat.)
Making the final shapes
The outer box for each of the shapes had a fixed size.
Then for the inner ones I used percentages! Both for their size (80% for finer ones, 33% for the granular ones) and their position. top: 10%; and left: 10%; ensured that they would be positioned at the empty inner space each individual shap made.
Lastly I made a container for them. And gave that one a flex display. So that they would be nicely aligned besides each other! (Otherwise there would be really weird offsets to the other ones!)
Of course, now the only left is to put them into the html! (Only 3 layers deep here, put you could easily add more divs!)
And of course this same thing can be done with any type of background image! Try it out yourself!