This article pays attention to the html tags in the previous perfect fairy tale. They are harmful, bad, obviously ugly, and should be excluded from standard html. To have only half the work, either subvert the browser or use the simpler and recommended new ones. Label.
Although the previous basic tutorials have provided suggestions that meet the standards, beginners have different foundations or incorrect exercises. Here is a summary.
HTML is trying to shift from performance to semantics, and then separate semantics (HTML) and performance (CSS). This has been widely used on web pages because a single presentation directive (CSS file) can be used on many pages. In this way, the website is easier to manage, and if you want to change the entire site, you only need to change a simple code.
Some harmful tags are actually simple presentation tags (such as small), which can be replaced by code with the same meaning in CSS. Other tags are not expressive, but are unnecessary (such as the font tag) or detrimental to usability (such as blink).
Tags
The tags listed below could use better options:
The b tag means bold. You can use strong instead, or add font-weight:bold in css.
i represents italic elements, you can use em instead, or add font-style: italic in css.
Big is used to express large text. You can use h1, h2, etc. in the title instead. Others can be specifically controlled in cssfont-size.
Small is used to express small text and can be controlled in cssfont-size.
hr represents a horizontal line, which can be replaced by border-top or border-bottom in CSS, or can also be represented by images.
The tags mentioned above all conform to recent HTML standards, but they do not impart semantic meaning to the content. They may have more uses but they are not significantly harmful and it can be very easy to make mistakes when standing on the crappy labels below.
u represents an underlined element. It keeps the text underlined like a connection, which is maybe why this tag disappeared, people really don't like unconnected text to be underlined.
center can center the element. The CSS property text-align can not only center center but also left, right and justify. menu is used to create a menu list. It does it more beautifully than ul, but unordered lists are more common, and ul replaces menu.
The layer element is very similar to the div element, but it only works in older versions of Netscape browsers and is of little use.
blink or marquee. Say a firm no to them.
font can be used to define the name, size, and color of the font. Older websites (and even current ones) that use font tags continuously throughout the page are like a termite plague. Some from web creation software place font tags around each element to control text color or size. Use the font tag to apply to every element. If expressed in CSS, it only takes a simple sentence, and it can be changed throughout the site. Using this method, you can not only reduce the size of the web page, but also change the content represented by the font by changing a simple css statement. This keeps the website style consistent. Font tags and misuse of tables are the main causes of bloated web pages.
Attributes
Now you may be using labels correctly, but they have some annoying parasitic properties that can lead to off-flavor.
name assigns a name to an element, which works perfectly in form elements such as input, but elsewhere, the name's job is taken over by the id attribute.
text and bgcolor are used to specify the basic text color and background color of the open body tag. The color and background-color properties in CSS can be well applied to the body selector.
background can specify a background image for the body tag. CSS can provide better background image attributes, such as background-image.
link, alink, vlink can specify the link color for the body tag. CSS properties: :link, :active, :visited have the same effect. align can control the arrangement of elements, such as <div align="center">Stuff</div>, but like the center tag, you can use the text-align attribute in css.
The target link is opened in different states, such as opening a new window <a href="wherever.html" target="_blank">Help me</a>. Sounds good, but doesn't feel familiar to the site. Users don't expect these (such as opening new windows) to appear like magic. Most users like to use the "back" button, and opening a new window means that this function is disabled. The performance attributes of the tag, such as the width and height of the image, the cellpadding and cellspacing of the table, determine the application of different attributes to different elements. They're not a perfect solution, but if your page has a lot of images or tables, you may not have any other viable options.
Most of the inexplicable presentation attributes belong to the textarea tag, which not only has cols and rows valid attributes, the latest HTML standard requires them.
Good label, bad application.
To enter your house, you might kneel down and crawl through a dog hole, but wait, there is a door decoration designed specifically for people - the handle, haha, look, the door is the right size for people to pass through.
HTML tags are designed for detail, and trust it or not, when you use them correctly, you can achieve the best results.
When HTML is semantic, web pages are more usable for users with disabilities, such as screen readers who often emphasize lists using ul tags or a heading using h1 or h2 tags.
The most serious abuse of HTML is tables. Tables are used for layout, but they are only used to represent tabular data. The idea of not using a table layout is not about seeking enlightenment like a Buddhist. It has real benefits, not only reducing the size of the web page, but also making it easier to maintain and redesign the web page.
Sometimes some designers use some tags and attributes to complete transitional designs (especially table layouts). First, they can support older versions of browsers (Netscape 4). Tables performed better than CSS in Netscape 4, but its users were very small and declining. Now that mobile users are increasing, table layout is very bad. The advantages of tables mentioned above far outweigh the disadvantages, and the reason is that the page needs to take into account all browser functions with as little style as possible.
Frames
Goldilocks thinks it's a very good idea to help her out with a bowl of porridge, but then three large predators appear and throw her out of the window. The frame is like a bowl of gruel that belongs to the bear. They look good, but danger is always present.
Most websites do not use frames, and most website users only use a single page.
But what if, for some reason, you need to prevent users from adding a specific page to their bookmarks, or you want to prevent specific pages from being introduced via email or instant messaging, or you want to add another level of overall complexity to using screen reading For disabled users of the browser who need to navigate between frames, or if you want to enter search engine hell, use frames.
Basically, frameworks do nothing but add complexity and lose usability.
Finally, if you follow the rules below, you won't go too far wrong.
1) If the name of the label or attribute is relatively unfamiliar, it is recommended to comment it or not use it. The efficiency of using css will be improved in this way.
2) Let the label do the job it is named for. Tables are used for tabular data. Just use the title for the title, and so on.
3) When you have clear content, use appropriate tags. Use lists for lists, titles for titles, and so on.