11

Yep, W3 says it's (<center>) deprecated... But all browsers support it (including new releases)...

Can anyone shed some light on this, everyone says "It's bad/frowned upon." yet I've seen no evidence..

PLEASE READ THE QUESTION, IT'S NOT A DUPLICATE:
I was asking why this is bad/frowned upon, not why it's been deprecated!!

Edit:
So, the only reason is that "The CSS should handle this"?

Barrie Reader
  • 10,647
  • 11
  • 71
  • 139
  • possible duplicate of [Why is the
    tag deprecated in HTML?](http://stackoverflow.com/questions/1798817/why-is-the-center-tag-deprecated-in-html)
    – Aron Rotteveel Feb 02 '11 at 10:51
  • It's been proven to be structurally unstable. cf. [bobince](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – Pekka Feb 02 '11 at 10:51
  • No, I'm asking why it's bad **not** why it's deprecated. – Barrie Reader Feb 02 '11 at 10:52
  • 1
    "Bad" is a matter of personal taste, deprecation is just a way to express the opinion of the minority. These two terms overlap in such a way that it can be called a duplicate, as the answer to both questions will most likely be the same. – Aron Rotteveel Feb 02 '11 at 10:53
  • 1
    Its not just deprecated because it's bad, its deprecated because the ability is done elsewhere (CSS). The only reason it's still supported is to not break compatibility and disown thousands of websites that may use it from the past. – Iacks Feb 02 '11 at 10:55
  • http://en.wikipedia.org/wiki/Separation_of_presentation_and_content – Álvaro González Feb 02 '11 at 10:51

5 Answers5

17

The issue is not that it is "bad". It a matter of separation of concerns.

This tag is intended to be used for presentation only. It has no other semantic meaning.

Since the move is to have presentation handled by CSS and HTML should only be used for semantic markup, the tag has been deprecated.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
2

The problem is its not semantic (which means it isn't describing the data is, but instead what to do with it).

HTML is meant to be semantic - its markup after all. Does XML describe how each of its nodes should be viewed? Neither should HTML, thats what stylesheets are for.

Its about separation of concerns at the end of the day - the more separation the less spaghetti soup of code you create and the more chance that what you write can be reused.

m.edmondson
  • 30,382
  • 27
  • 123
  • 206
2

As <i> or <b>, those tags got nothing semantic. It's just style which should be handled with CSS and not HTML.

Shikiryu
  • 10,180
  • 8
  • 49
  • 75
  • So this begs the question: Why *should* `` or `` be handled by the CSS? Is it an unwritten rule? I mean, they can still be used without hassle - right? – Barrie Reader Feb 02 '11 at 10:55
  • 1
    `deprecated` doesn't mean `mustn't be used` or `can't be used`. HTML should be used for data and semantics as CSS should be used for style and presentation. That's why `` _can be replaced_ by `` (which mean emphasize) and `` by ``. Both have semantic value : they mean you want to emphasize a part of your text, `i` and `b` _only_ means italic and bold which can be handled by `font-style:italic` or `font-weight: bold` in CSS. – Shikiryu Feb 02 '11 at 10:58
2

Since a long time, W3C encourages everyone, any developer and Web browser implementations to enforce CSS for defining the style of HTML, XHTML layouts.

That's "center" element defines how some content must be presented, while XHTML/HTML must define "the document" - the meaning, semantics -, never "how to show content". This is CSS role.

This tag is supported for backwards compatibility, but no one should be using in new Web developments, even knowing that CSS is easy but sometimes centering some part of a layout needs advanced styling skills.

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
1

It defines the presentation of its contents instead of describing them. And presentation and data should be split.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636