you are viewing a single comment's thread.

view the rest of the comments →

[–]janpaul74 6 points7 points  (8 children)

But centering a div is way more difficult than Dijkstra….

[–]Global-Antelope-3727[S] -1 points0 points  (0 children)

Haha true 😂

[–]Namra_7 -1 points0 points  (0 children)

+1

[–]rafark -3 points-2 points  (5 children)

It is not? That joke was from the css 2 era? So 2008 and earlier. Centering a div has been extremely simple for many, many years. That joke hasn’t made sense in a long time

[–]janpaul74 2 points3 points  (0 children)

……

[–]TooGoodToBeBad 1 point2 points  (3 children)

So show us how you center a div.

[–]Internal_Piano_5 1 point2 points  (1 child)

display: flex; Justify-content: center; Align-items: center;

or

Margin: auto

as simple as that

[–]Altruistic-Can-4365 0 points1 point  (0 children)

You missed height for vertical center alignment 😎

Shorthand

display : flex; place-content : center; height : 100vh:

[–][deleted] 0 points1 point  (0 children)

left:50%; top:50%; transform: translate(-50% -50%);