Disadvantages of using consistent-behaving yet deprecated HTML tags?

前端 未结 6 1981
庸人自扰
庸人自扰 2021-01-19 03:52

When users visit my website, they don\'t care about how perfect or how much standard the page is coded. They only care about whether it works or not.

6条回答
  •  囚心锁ツ
    2021-01-19 04:22

    Potential disadvantages include the following:

    1) Your customer might actually care about how standard the code is. Maybe not now, but in the future. Maybe for questionable reasons, but still.

    2) Deprecated constructs do not always work consistently. For example, align=center attribute set on a table may have different effects depending on browser mode. This is a relatively weak argument, though, since the browser practices have been described rather well in HTML5 CR and you can manage the potential problems. (Besides, even CSS settings may work inconsistently.)

    3) There is no guarantee that deprecated features will be supported by all future browsers. On the other hand, the same applies to standard features. In practice, very few features that have been defined in HTML specifications have actually been removed from browsers. (Regarding tags, I think basefont is the only case.) All the examples mentioned, and also marquee, have been described in HTML5 CR as “obsolete” but still well-defined, and according to HTML5 CR, browsers are expected, and partly required, to support them all.

    4) Your colleagues (designers/developers/...) may regard your code (and you) as old-fashioned, non-semantic, and whatever.

    5) Code maintenance and development may be more difficult. If you have 1,000 pages with and the customer says they want a somewhat different background color, you would need to edit each page. This argument is, however, weaker than it seems to be. First, how often do such things actually happen? Second, if the pages have actually been generated using suitable tools, perhaps you just need to change the value of one parameter and regenerate them (or just let servers do that, if the pages are dynamically generated). Third, if you have a link element on all pages, referring to basic style sheet for the pages, as you normally should, you just need to add one rule to that style sheet. It is easy to override presentational HTML attributes with CSS.

    To summarize, the practical arguments against your approach are rather weak. The most important arguments relate to coding style and principles.

提交回复
热议问题