Live data from Hacker News

How to Center in CSS (2015)

howtocenterincss.com

41–50 of 74 posts

Re: How to Center in CSS (2015)

#42
post #25

It doesn't solve vertical centering, but I am secretly still a fan of the center-tag. Just does what it's name implies in most situations. I still don't get why its avoided like the plague.

Earlier HTML had tags that styled elements. The community decided it would be better if styling was left to CSS and HTML simply described document structure. This way styling lives in one kind of file instead of two different places. I wouldn’t recommend using it for big or professional projects, but I guess it’s fine for personal stuff. Like the other comment said it’s an obsolete tag. Browsers tend try hard not to…

There are to many websites using it to ever remove it.

Re: How to Center in CSS (2015)

#43
I was explaining this to a normal person the other day, and maybe I'm doing it wrong, but it was impossible not to make it sound like we are weanies. I mean complete knee-biting berks.

"What do you mean centering was hard?"

"Not was, still is."

"..."

"yeah. ..."

Re: How to Center in CSS (2015)

#44
post #40

Earlier quoted context omitted.

I've been doing HTML for ~10 years and have never seen this before. Apparently, it was deprecated with HTML4 already, though I'm not sure why.

Probably the same reason that (bold) and (italics) aren't used anymore. There's now a clearer delineation between document structure (described via tags) and style (described via CSS) than there was in the earlier HTML specs.

If you allow user generated input it is fine to allow , or

Re: How to Center in CSS (2015)

#46
post #40

Earlier quoted context omitted.

I've been doing HTML for ~10 years and have never seen this before. Apparently, it was deprecated with HTML4 already, though I'm not sure why.

Probably the same reason that (bold) and (italics) aren't used anymore. There's now a clearer delineation between document structure (described via tags) and style (described via CSS) than there was in the earlier HTML specs.

b and i are back though, but a little different ;)

> The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede.

and

> The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts.

[0]: https://html.spec.whatwg.org/#the-b-element

[1]: https://html.spec.whatwg.org/#the-i-element

Re: How to Center in CSS (2015)

#49

Centering in CSS is "solved" problem if your "worst" browser to support is IE11. Flexbox does the job there. However, there are still couple of common tasks that are pain/hard/impossible to do with just CSS. Recently I learned that after all this years you still need to use JS to get css animation for dynamic height ("height:auto") of elements. And there is no progress in fixing it at CSS standard level. It's just sa…

There are some tricks you can use if you know the max possible height your element can have, but it's not great, yeah. Edit: Oh, I just saw that the stackoverflow question you linked has this for the accepted answer :)

The problem is the animation speed is overly fast if you're at less than that maximum height.

Re: How to Center in CSS (2015)

#50
12 years ago at W3C styles I've proposed to solve it as simple as this:

   .in-the-middle {
     width:max-content;  
     height:auto;
     margin:*; // "coils" on all sides moving it 
               // to the middle of free space in container
   }
So these tons of tools, essays and doctoral dissertations on "how to center stuff" would not be needed.

Here is the story: https://terrainformatica.com/2018/12/11/10-years-of-flexboxi...

Post reply on HN