Hacker News new | ask | show | jobs
by max-throat 860 days ago
The fact that centering a div in CSS basically requires a doctorate is the entire reason I gave up on web dev.
7 comments

If you think flex centering is the equivalent of "requires a doctorate" I'm not surprised you weren't cut out for web dev
Such venom.

I am sure the GP was just trying to be comedic.

Damn, that’s a harsh response
And well deserved.
So for those of us that consider this dead simple, can we just start adding CSS Ph.D on our CVs?
No, you also have to throw away 3-6 years of your life.
I don't know about that. I'm not a UI person, yet I feel like I have a pretty good grasp on CSS. I actually like it. So when I'm sick and tired of programming things, I've found myself recreating the layout of some site I liked by writing the CSS/HTML by hand. You learn pretty quick that way. It's a shame that all UI is now only allowed to be done with some library or other.
I was referring to the observation that getting a Ph.D. usually requires wasting 3-6 years of your life doing something tedious and useless (source: my time getting a Ph.D. in computer science)
Those years were called "IE 6"
was it only 6 years? felt like 20. surely it didn't qualify for early release for good behavior
My comment was partly tongue in cheek.

It did feel like 20 years, though.

According to Wikipedia, it was initially released in 2001 … which … seems later than I remember? I don't remember upgrading to it, but I guess Win 98 came with IE 5? But +20 years would be 2021 so … I guess it wasn't quite. I was using Firefox by at least 2006, maybe 2007 at the latest.

The simple version is buried halfway down the article, but:

    .container {
       display: grid;
       place-content: center;
    }
isn't so bad.
The container is body, does not need a class in the simple version.
The problem is it was easy to center things with tables. Then once CSS was popular, that was the "wrong way" to handle layout. I find CSS the worst part of web development, and it's what turned me off of front-end work. Glad flexbox has finally made things simpler again.
I like CSS but I'd agree that tables got a bad rap. They were very easy, very effective, and only occasionally turned into a nightmare of nesting that was impossible to maintain

My problem with CSS now is that it's gotten too bloated to the point where it's introducing privacy and security risks. I really want an add-on that restricts CSS by default to only a sane subset of features.

Using tables for layouts is an accessibility nightmare.
They're also awful to maintain over time, if you're needing to add new elements and require new columns or cells (and then there's the need to nest tables when using them for layout).

I attempted to fix a website by adding closing table cells that were missing, and finally got the page to validate as XHTML Strict and Transitional. The entire layout shifted, and was completely based on those missing end tags.

it's really not. It requires adding a single attribute to tables that exist for layout.
What attribute? And how do you affect the reading order? Say on a page with a side navigation?
Google for "The Web is Ruined and I Ruined It" written by the guy who first came up with the idea to use tables for layout.
There weren't really many other options in the 90's.
Not the point. The point was that some people still think there is nothing wrong with using tables for layout. The guy who started it all would like to have a word with them.
I empathize! It used to, but no longer, so give it another shot! :)
It requires single-digit minutes of work. I don't have a doctorate but I gather that it is rather more difficult.
It's about as hard as in any frontend framework, native or non native.
Did you read the article? Specifically the Flexbox example.