Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why some HTML elements are deprecated

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

In this issue, the editor will bring you about why some HTML elements have been abandoned. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The Internet has been around for a long time, and with the passage of time, we have changed the way we think about web design. With the emergence of new and better alternatives, many old technologies and ways of doing things have been eliminated, and we say they have been abandoned.

Use (Deprecated) is not recommended. This is a word we often use and see. But have you ever stopped to think about what it means in practice? Are there any examples of obsolete web page elements, and why don't we use them anymore?

What is deprecation?

In general, the old functionality can still be used for backward compatibility (so legacy projects will not be broken). In essence, this means that you can still do things the traditional way technically. It may still work, but it may be better to use a new way.

Another common situation is that when a technical element is abolished, it serves as a prelude to its future deletion (we sometimes call it the "sunset West Mountain" feature). This provides everyone with time to transition from the old way of working to the new system.

Why is the HTML element deprecated?

The way we think about HTML has also been evolving over the years. Originally, it was a universal markup language for online display and styling of content.

Over time, as external stylesheets become more and more important, it makes more sense to think about Web development in different ways-separating concerns, where HTML defines the content of the page and CSS handles the performance of the page.

This separation of style and content brings many benefits:

Avoid repetition: if you can get a CSS class to process all the red text at once, it is cumbersome and inefficient to repeat the code for each red text instance on the page.

Easy to manage: with all the representations controlled by a central stylesheet, you can easily modify the entire site.

Readability: when viewing the source code of a website, the content and style are neatly abstracted into separate files, and the content and style code is much easier to understand.

Caching: all pages on most websites have a consistent style, so why let browsers download these style definitions over and over again? Put the style file code in a dedicated stylesheet that can be cached and reused to save bandwidth.

Developer specialization: large website projects may require multiple designers and developers to work, each with its own area of expertise. It is much easier for everyone to let every CSS expert work on the project in his or her own file.

User options: separating style from content makes it easy for developers to provide end users with display options (the increasingly popular "night mode" is a good example) or other accessible display modes.

Responsiveness and device independence: separating the content code from the visual rendering code makes it easy to build websites that are displayed in different ways at different screen resolutions.

In the early days of HTML, however, there were a considerable number of tags designed to control the appearance and content of pages. You may see the following code:

Hello world!

... Because of the separation of the above concerns, all of these have now been deprecated.

Which HTML elements are not recommended at this time?

For beginners, why are some HTML elements discarded?

Starting with the HTML5 version, the following elements are discouraged:

(use instead)

(use)

(use CSS font properties, such as font-size, font-family, etc.)

(using CSS font-size)

(using CSS text-align)

(use)

(use CSS font properties)

(use)

(no longer needed)

(no longer needed)

(no longer needed)

(use text-decoration: line-through)

(use text-decoration: line-through)

(use)

Continuing the theme of the separation of content and presentation, CSS is a more effective way to create a visual layout without cluttering the main HTML document code.

So, when should I use it? Of course, the actual tabular data! If you need to display a list of baseball scores, statistics or other aspects

He's your friend.

Why do we still use and label?

You might say, "wait a minute. Why do you still think bold and italic HTML tags are OK? shouldn't those visual styles be handled with CSS?"

This is a good question, and it seems difficult to answer when we consider abandoning and other tags like that. What's going on here?

The short and simple answer is that, were it not for being so widespread and useful, they are likely to be eliminated. By contrast, CSS alternatives seem clumsy:

.emphasis {font-weight:bold} This is a bold word! This is a bold word! This is a bold word!

The long answer is that these tags have now been given a certain semantic meaning, giving them value beyond pure visual expression, and allowing designers to use them to give additional information to the text they contain.

This is important because it helps screen readers and search crawlers better understand the purpose of the content contained in these tags. For some reason, we may use an italic to represent a word, such as adding emphasis, invoking the title of a creative work, quoting a scientific name, and so on. We may skew a word for several reasons, such as adding emphasis, quoting the title of a creative work, quoting a scientific name, and so on. How do readers know if they want to focus on the colloquial word?

Together with companions, including, and, these tags make the meaning context of the text clearer:

It is used to draw people's attention to the text without giving any other attention. We use this word when we want to attract attention without changing the glyph of text read by screen readers, or when we do not add additional weight or meaning to search engine content.

It's very similar, but it marks the importance of something. This is the same as changing the pronunciation when you increase the emphasis on a word.

Skew the text without giving any other meaning or emphasis. It is very suitable for writing something that is usually italic, such as the scientific name of an animal.

Similarly, because it makes the text italic, but it provides additional emphasis (and therefore the tag name) without adding more importance in the context.

It's the title we use to refer to creative works, such as movies like Silence of the Lambs. In this way, the text can be styled, but it does not affect the way the sentence is read.

In general, the rule is, and can only be used as a last resort, if you can't find something that better suits your needs. This semantic meaning allows and continues to have a place in our modern array of HTML elements and survives the elimination of other similar style tags.

In the related description, (underscore marks) was deprecated, but has been restored in HTML5 because of some semantic use (for example, comment misspelling).

There are many other HTML elements that can style content, but are mainly used to provide semantics for content.

Immortal HTML attribute

Today, some obsolete elements are still widely used on the Internet. After all, they are still valid-just eliminated.

Sometimes, what you have been using has not been spread, but it is no longer the way it used to be.

Such an immortal HTML relic is the align attribute in other valid tags, especially images. You may see a tag with the border attribute, even though it has long been deprecated. Of course, CSS is the preferred and modern way to represent this style.

For any web developer, keeping up with the times is the key. It is a basic best practice to ensure that your code follows current recommendations while avoiding legacy elements. It can not only ensure that your site will continue to work for a long time, but also work well with the future network.

This is why some HTML elements have been discarded. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report