Is the central tag valid?

I mainly use the HTML <center> to center most of my objects. I just wanted to confirm if the tag is valid or not?

+4
source share
2 answers

While I agree with the other answers, I do not agree that w3schools is a good source ... well, something really. Look at the specification when searching for data:

HTML4 Specification :

The CENTER element is exactly equivalent to setting the DIV element with align set to "center". CENTER element deprecated .

Does it persist? Nope (but it works, this is another question), it is deprecated with HTML4 - semantically it is simply not related to other elements.

+6
source

Really? Like in "is this a valid W3C markup"? Yes (Although not recommended).

Should you use it? No. The <center> has no semantic meaning on the web page and is a styling element of par excellence. Use proper CSS alignment and positioning to style your web pages.

To align the text, use text-align: center; .

To position an element, use the fields of automatic width: margin-left: auto; margin-right: auto; margin-left: auto; margin-right: auto;

+1
source

All Articles