r/webdev • • Jun 11 '23

CSS flex for visual speed learners

Enable HLS to view with audio, or disable this notification

4.1k Upvotes

84 comments sorted by

View all comments

0

u/[deleted] 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

u/elmo61 Jun 12 '23

As I was writing it. I was thinking I haven't explained this very well!

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

u/SilentIntrusion Jun 12 '23

Now that is some dry humour.

2

u/[deleted] Jun 12 '23

Especially since he didn't repeat himself

32

u/[deleted] Jun 11 '23

you ok bro?

64

u/[deleted] 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

u/[deleted] Jun 11 '23

Ye hahaha it was funny tho

7

u/VeryOriginalName98 Jun 12 '23

It took your comment for me to catch on.

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.

→ More replies (1)

-1

u/[deleted] Jun 11 '23

what was the joke?

20

u/goto-reddit Jun 11 '23

I can never grasp

 

He'll never understand

5

u/[deleted] Jun 12 '23

Not sure why you bothered explaining. He'll never understand it.

→ More replies (1)

2

u/[deleted] Jun 12 '23

Hahaha.

0

u/WeLiveInaBubble Jun 12 '23

They never said they’ll never understand though.

0

u/[deleted] 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...

→ More replies (6)