Is the center tag still valid?

↘锁芯ラ 提交于 2019-12-05 16:52:51

While I agree with the other answers, I don't agree w3schools is a good source for...well, anything really. Look to the specification itself when looking for data:

The HTML4 spec:

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

Is it still valid? Nope (but it works, that's a different question), it's been deprecated since HTML4 - semantically it's just not inline with other elements.

Valid? As in "this is W3C valid markup"? Yes. (Albeit deprecated).

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

For text aligning use text-align: center;.

For element positioning use auto-width margins: margin-left: auto; margin-right: auto;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!