Why is the font element not supported in HTML5?

后端 未结 3 1190
萌比男神i
萌比男神i 2021-01-11 16:04

I am just curious really and hope that someone can reveal the method in the madness of the W3C. What is the reason for not supporting this element in the latest HTML5 standa

相关标签:
3条回答
  • 2021-01-11 16:49

    In short:

    HTML is a markup language. Use it to mark up the different sections of your content using the most semantically accurate element.

    CSS is used for styling purposes, such as changing colors, sizes, fonts, etc.

    The <font> element was used for styling, not marking up a section of your content. That's why it's deprecated, along with other out-of-place elements such as <center>.

    0 讨论(0)
  • 2021-01-11 17:02

    There are lots of ways to wrap inline content, but only one of them has no semantics associated with it (span). Of the list of block wrappers you gave, only div has no semantics associated with it.

    The old font element has no semantics associated with it, so it contributes as much as span and can be replaced by span.

    The idea is that you pick the element that describes why the text looks different (<em>, <cite>, <dfn>, etc) and then apply CSS to make it look the way you want.

    And really, one little tag can't do any harm, so why not still support it?

    It is supported, the rendering rules describe how browsers should handle the font element. This is for backwards compatibility. Authors are just forbidden from using it (since it does no good).

    0 讨论(0)
  • 2021-01-11 17:06

    HTML tags describe their contents. To mark up your HTML you should use CSS. In such way you can create different skins for the same information. Since the font tag serves purely visual purpose, it has no place in HTML; it does not describe the contents.

    With describing contents I mean: "This is paragraph of text / this is a time / this is a link to another page / this is the title of this article / this is a list of related terms / this is a table containing test results" etc.

    Read up on semantic HTML, it will hopefully make things more clear for you.

    0 讨论(0)
提交回复
热议问题