Barrie Reader
Barrie Reader

Reputation: 10713

What is so bad about the center tag?

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"?

Upvotes: 11

Views: 2652

Answers (5)

Mat&#237;as Fidemraizer
Mat&#237;as Fidemraizer

Reputation: 64943

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.

Upvotes: 2

Shikiryu
Shikiryu

Reputation: 10219

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

Upvotes: 2

ThiefMaster
ThiefMaster

Reputation: 318688

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

Upvotes: 1

Oded
Oded

Reputation: 499262

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.

Upvotes: 17

m.edmondson
m.edmondson

Reputation: 30922

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.

Upvotes: 2

Related Questions