529
Average CSS (lemm.ee)
submitted 1 week ago by [email protected] to c/[email protected]

I am not allowed to credit the site that has this disaster. Its owner said "Nobody should see that"

you are viewing a single comment's thread
view the rest of the comments
[-] independantiste 23 points 1 week ago

At least that's actually easy and quick to do and is the only way of doing it. Centering a div however has 81639393 ways and it seems the one that works is different every time

[-] [email protected] 45 points 1 week ago

Bro its so easy bro, just use flexboxgridcolumns its been a standard since 2010 just flex it bro you haven't learned to flex yet just check w3c schools and add a flex you can polyfill it but don't use that hacked one use the good flexpolyfill then { content-align-middle-child-elements: center-middle-true-neutral } so easy with flex bro

[-] [email protected] 17 points 1 week ago

I know you meant this sarcastically, but yes, flex is a good option for centering something. Either that or setting the left and right margins of the element to auto, which is generally even easier.

Basically, if you're in a flex container use flex, if you're in a grid use grid, and if neither of those apply set the left and right margins to auto.

[-] [email protected] 6 points 1 week ago

Also seriously, anybody having problems with flexbox should try this:

https://flexboxfroggy.com/

I'm not sure there's any version of it for grids, but IMO grids are inherently more intuitive, so it may not be needed. Flexbox is the one that is hard to learn.

[-] [email protected] 3 points 1 week ago

Well, flexbox and grid have different purposes in my opinion/experience. Personally I use grid for "top level" layouts like the layout of the whole site, while I tend to prefer flexbox for layouts inside the grid. Of course that's just a rule of thumb, there are absolutely cases where this isn't the best option.

[-] [email protected] 3 points 1 week ago

I don't know any CSS (despite reading memes about it like this) but I do know that the bottom of that page has a link to something called Grid Garden

[-] [email protected] 2 points 1 week ago
load more comments (12 replies)
load more comments (12 replies)
this post was submitted on 07 Jul 2024
529 points (96.8% liked)

Programmer Humor

18388 readers
529 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS