27
u/Abangranga Jun 12 '23
Nice video, but the bouncing effect gives us like 1/3 the time to actually look at it and make it difficult to pause it fully expanded.
37
u/Ynkwmh Jun 11 '23
Can you slow that down? Lol
23
u/1920MCMLibrarian Jun 12 '23
I’m unreasonably annoyed by it lol
16
u/Abangranga Jun 12 '23
I can decide if the duration or the bouncing effect is worse.
4
5
u/stpetepatsfan Jun 12 '23
Stop at max size and becomes a visual cheat sheet.
Now create some text boxes, img boxes and play around using these settings.
32
u/n9iels Jun 11 '23
Cool! I can recommend https://flexboxfroggy.com too if you like to learn interactive
15
Jun 11 '23
nobody in the world could learn this faster by reading. this is for everyone and not just visual learners
17
6
3
Jun 12 '23 edited Jul 10 '23
intelligent literate payment deliver dinner memory aloof drab cause slimy -- mass edited with redact.dev
3
u/atalkingfish Jun 12 '23
I don’t think throwing “stretch” in there makes sense. Stretch is more for “align-items”, as the justified width is controlled by “flex”. Throwing in “justify-content: stretch” will not, on its own, typically give the desired results.
2
u/runeklf Jun 11 '23
Looks cool! Would you mind to post a link to the a repo?
2
0
u/GodGMN Jun 11 '23
You could try to replicate yourself and play with it so you can see the differences :) doesn't need to be as fancy as this one
2
2
2
u/VehaMeursault Jun 12 '23 edited Jun 12 '23
OT: there’s no such thing as being a visual learner. Veritasium did a whole vid on it and it was a relief to watch that myth be dispelled.
Nice presentation of flex properties nonetheless, however.
1
u/mrsxfreeway Jun 17 '23
Whilst there’s no such thing, I prefer visual aids and example, so there’s that. Some of us cannot just read text and understand it, we need to see it in action.
0
u/jordsta95 PHP/Laravel | JS/Vue Jun 12 '23
There are visual understanders though.
If someone verbally teaches how to do something/what something does, then you may understand everything, but cannot comprehend what they actually mean.
For people such as myself who cannot visualise things in their head, visuals like this are a godsend.
Obviously, the best way to know what each flex justification does is to mess around with it, as you may be using weird margins that affect the result. But for a quick guide to sanity check, stuff like that is a great help.
1
1
u/heathcliff6547 Jun 12 '23
It's pretty cool and easy to understand justify-content. I like flexboxes it's easier to build with it and I don't have to deal with floats and clearfixes
1
1
1
1
u/Spizace Jun 12 '23
Whats the difference about space-evenly and space-around ?
2
u/jordsta95 PHP/Laravel | JS/Vue Jun 12 '23
space-evenly will ensure the margins between each item and the margins are exactly the same.
For example, if your container is 1000px, you have two items which are 405px wide inside it. This leaves you with 90px unused space. So space-evenly will put 30px to the left of the first item, 30px between the two items, and 30px to the right.
(So the layout is: 30px | 405px | 30px | 405px | 30px)
However, space-around gives the margins at either end half the space that it would put between items.
So now, with the same container & items you have 45px between the items, and 22.5px on the margins.
(So the layout is: 22.5px | 405px | 45px | 405px | 22.5px)
This essentially makes it the middle ground between space-between and space-evenly
1
1
1
1
1
1
1
-1
0
Jun 11 '23
[deleted]
164
u/elmo61 Jun 11 '23
Space around puts padding of X on both sides of each element. So first element has X space to the left. And last element will have X space to right. Between two elements there wil be a padding of X to right of one element and X to left of next element. Doubling up making spaces 2x
Space evening just ensures space is same between elements as well as before first and after last elements
41
u/Frodolas Jun 12 '23
You were so close. Just need to say
space around looks like: X A X X B X X C X
where X is 1/6th the total whitespace in the flex container
space evenly looks like: X A X B X C X
where X is 1/4th the total whitespace in the flex container
9
11
u/midsizedopossum Jun 12 '23
You were so close.
What? They were completely correct.
4
u/sleepydozer Jun 12 '23
Yeah haha. In fact, this re-written explanation could be confusing because it uses 'X' to explain both scenarios even though the gaps in both are different sizes, and then has to redefine 'X' (1/6th remainder space in one, 1/4th in the other) to account for that
7
u/LazaroFilm Jun 12 '23
Space around:
[1u][A][2u][B][2u][C][1u]Space evenly:
[1u][A][1u][B][1u][C][1u]
[1u]being an arbitrary scale value of space.73
u/mountaineering Jun 11 '23
Not sure why you bothered explaining. He'll never understand it.
30
32
Jun 11 '23
you ok bro?
64
Jun 11 '23
It was clearly a joke. And i laughed a bit haha, cuz the person said they'll never understand.
47
u/mountaineering Jun 11 '23
Wild how basically nobody connected the statement
15
7
3
u/pimp-bangin Jun 12 '23
I bet people lost track of the original statement because the reply was long and takes time to process.
Also if OP said "I will never understand" instead of "I can never grasp" then the connection would've been more immediate.
With the right timing and delivery, this exchange would be hilarious as a sitcom bit.
1
→ More replies (1)-1
Jun 11 '23
what was the joke?
20
2
0
0
Jun 11 '23
[deleted]
35
u/mountaineering Jun 11 '23
Are jokes not allowed here? I was referencing that he said he can never grasp it...
0
Jun 11 '23
[deleted]
22
u/PacificBrim Jun 11 '23
No, you missed the joke. Above comment said he could never grasp it.
nev·er
/ˈnevər/
adverb
at no time in the past or future; on no occasion; not ever.
Below commenter was making a light-hearted joke based on his language being literal. No one thinks the guy actually could never grasp it.
Thanks for making me ruin it
28
Jun 11 '23
Not sure why you bothered explaining it. He'll never understand it.
18
u/thisisme1101 Jun 11 '23
Why so rude wtf
1
u/Timmah_Timmah Jun 12 '23
The fuck is: first.commenter said please eli5 because I will never understand it. Next guy explains it, third guy says why did you do that he said he would never understand. I said why so rude because it wooshed over my head that time. Then others said it was a joke and got downvoted then apparently whooshed over again. Then here we are.
22
u/mountaineering Jun 11 '23
Lmao I don't think he's stupid at all. I don't know the guy. I was literally just referencing his own bit
34
u/GodGMN Jun 11 '23
"Space evenly" has the same amount of space around the elements, including between them, like:
1 Space Element 1 Space Element 1 Space "Space around" however, sets the space around each element, leaving a bigger space between the elements and a smaller space to the edges of the container:
1 Space Element 1 Space 1 Space Element 1 Space Note how there are two spaces inbetween. Because spaces are set at both left and right of each element.
Summarizing: in "space evenly", every space is the same, so they're even.
"Space around" puts the space around each element.
5
u/NoMoreVillains Jun 12 '23
This post did a better job explaining it than the actual visual being discussed
4
5
u/notislant Jun 11 '23
Buddy explained below but just for the hell of it:
Space evenly : even space between all elements and container borders.
Space around example: each element has +100px to the left and right of it.
Element and container border have 100px space.
Two elements have 100px+100px between.
Each element basically has 100px left and right spacing.
2
1
u/jimbo493 Jun 12 '23
Here’s another way to understand it, space around puts the same amount of space around each object, then puts the objects next to eachother, which means between objects there’s twice as much space as there is on the outside edges. Space evenly does exactly what it says, it puts the same amount of space between each object, and at the edges.
What this means is around will make the margins smaller while keeping the objects spaced compared to evenly.
44
u/artyhedgehog react, typescript Jun 11 '23
Nice, but that's not the full flex - only the "justify-content" part.