Hacker News new | past | comments | ask | show | jobs | submit login

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 break old HTML but not sure that’s guaranteed to always be the case.


Didn’t HTML5 remove the <center> tag? In that case, just seeing the HTML5 DOCTYPE should allow ignoring those elements (as in not styling them). For example, if I do:

    <center>
        Text
    </center>
...just treat the tags as <doc> tags:

    <div>
        Text
    </div>
I understand there are many websites following older standards, but I can wish (for HTML5 to have been “strict”)


I know, but I still think <center>text</center> ist more readable then most of the css workarounds we had to use in the past.


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


It's avoided because it's obsolete and is not in the HTML5 spec: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ce...


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 <b> (bold) and <i> (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


To add to this: if you want to draw attention for reasons that don’t fit the <b> and <i> tag’s purpose, there’s <em>.


If you allow user generated input it is fine to allow <center>, <b> or <i>


Now I feel old. On the other hand, apparently I'm doing HTML for >20 years. Let me tell you about blink and marquee ... ;)


For some reasons, I've encountered those before. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: