Coder Perfect

Why is the center> tag in HTML deprecated?


I’m just puzzled as to why the HTML center> tag got deprecated in the first place.

The encapsulation of the container in a center> tag was a simple means of immediately center-aligning blocks of text and pictures, and I truly can’t think of a better way to accomplish it anymore.

Is there a simple way to centre “things” (not the margin-left:auto; margin-right:auto; and width thing) that may be used instead of centre>? Also, why was it obliterated?

Asked by Andreas Grech

Solution #1

discouraged since it just describes the presentation of its contents, not the contents themselves.

Setting the element’s margin-left and margin-right attributes to auto, then setting the parent element’s text-align property to centre, is one method of centering. In all modern browsers, the element will be centred as a result of this.

Answered by Jordan Ryan Moore

Solution #2

According to,

The HTML 4.01 specification cites the following explanation for the tag’s deprecation:

Answered by Conrad Meyer

Solution #3

Because nothing else in CSS works as well, I still use the center> tag on occasion. Attempting to utilize the div> technique and failing:

center> produces results. To use CSS instead, you may need to insert it in multiple places and fiddle with it to get it to center correctly. To answer your question, CSS has become a religion among believers and followers who regard center> b> I u> as blasphemous, unholy, and far too simple for the sake of job security. Ask them what the CSS counterpart of the colspan or rowspan attribute is if they try to take your table> away from you. It is the experienced truth, not the abstract or academic truth, that counts. Zenith

Answered by Russell Hankins

Solution #4

Allow me to explain, because there are some well-known downvoters who will assume I’m defending old-school HTML4 or something. No, I’m not one of them. However, the dispute over center is only a trend war; there is no compelling reason to abandon a tag that serves a useful purpose.

So, let’s look at the main counter-arguments.

Answered by dkellner

Solution #5

I take typical chores like centering and floating and turn them into CSS classes. When I accomplish that, I’ll be able to use them on any of the pages. I can also summon as many people on the same element as I wish.

.text_center {text-align: center;}
.center {margin: auto 0px;}
.float_left {float: left;}

Now I can utilize them to execute simple operations in my HTML code.

<p class="text_center">Some Text</p>

Answered by Scott Radcliff

Post is based on