Discontinuation of the <center> tag

Asked

Viewed 1,472 times

6

I know it seems like a lot, maybe it’s really a lot of lack of knowledge, but I’ve done some research and I haven’t found anything that would actually convince me.

Does anyone have any, or knows why the tag was discontinued?

Because sometimes I find it much easier than having to center using CSS. Someone has an explanation?

2 answers

10


As HTML, CSS and Javascript/DOM were evolving, the "evangelists" of the web standards began to advocate a clearer separation of the responsibilities of each of these layers, seeking to mitigate the HTML problem "spaghetti".

Responsibilities are:

  • HTML: give away structure the content according to its sense.
  • CSS: define the appearance of the rendered HTML.
  • Javascript: define the demeanor of the document in interaction with people.

The tag <center> had a purely visual end, not structural or semantic. So it was a part of HTML that should be handled by CSS, and so it was discontinued. It also happened with various other elements and attributes.

  • Excellent response.

  • Convinced! But I still think it’s always easier to write <center> than <div class="central"></div>. kkkk.

  • @Coldhack It would actually be more semantic to use <div class="conteudo-principal"></div> (that is, a class name that tells the function of the content). ;)

  • @Coldhack - Absolutely. However, think that you have several elements with <center> and later need to change to left or right, you would have to change each element. With CSS you would only need to change the style and all the elements would adapt...

  • You’re right guys, I even know that only... uffas

5

. The tag should be avoided because it has been disapproved since HTML version 4. [source]
. Not only is HTML5 not supported. [source]

<center> is obsolete but its effect can be achieved using align or a formatting of the element by css. It is no more than a shortcut to <div align="center">. Align remains valid, <center> should be avoided.


Debate 1, Debate 2. Both approach the disuse of the tag center.

  • @Thallyson Dias, this information is not guaranteed for me. Sorry, I will undo the update. You can comment below your statement.

  • The first source does not explain why, it just says that it has been discontinued since version 4 of HTML, so one should avoid use. And yes, I already knew it’s not supported in HTML5, but where I can find at least one explanation of its discontinuation. If align is still allowed(used), why take center? Thanks for the ready response.

  • The exact reason only if it is in doc, otherwise it may be mere speculation. here has a debate with some interesting points, but nothing official.

  • @Coldhack, the second response of debate 2 that I quoted, offers the best justification, in my opinion. I’m on cell phone now, then I’ll do a transcript.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.