Beginner Web standards should be noted: harmful labels

Source: Internet
Author: User
Tags add html tags version window
Standard | beginners | Web page

This article takes note of the previously perfect fairy tales of HTML tags, harmful, bad, obviously ugly, should be excluded from the standard HTML tags, to only half the workload or subversion browser or use a more simple recommended new tags.

Although the previous basic tutorials have made recommendations that meet the criteria, the beginner's base is different or the practice is not right, and here's a summary.

HTML is trying to move from performance to semantics, thus separating semantic (HTML) and presentation (CSS). This has been widely applied to web pages because such a single representation instruction (CSS file) can be used in many pages. In this way, the site is more conducive to management, want to change the whole station just change a simple code.

Some harmful tags are actually simple performance tags (such as small) that can be replaced with code in the same meaning in CSS. Others are not a performance label, but not necessarily (such as a font tag) or detrimental to usability (such as Blink).

tags tags
The following list of tags can be better chosen:

b label is bold meaning, here can be replaced with strong, or in the CSS to add font-weight:bold.

I represent italic elements that can be replaced with EM or add font-style:italic to CSS.

Big used to express large text, the title can be used H1,H2 and so on, and other can be in cssfont-size specific control.

Small is used to display small text, which can be controlled in cssfont-size.

HR represents a horizontal line that can be replaced with border-top or Border-bottom in CSS, as well as picture performance.

The labels mentioned above are adapted to the most recent HTML standards, but they do not give semantic content. They may be of more use but they have no significant harm, and it can be very easy to make mistakes when standing on the chaff tag below.

U represents an underscore element. It keeps the text as underlined as a connection, which may be the reason why the label disappears, and people really don't like the text with no connections underlined.

Center allows you to center elements. CSS Properties text-align not only center center but also left,right and justify. Menu used to make a list of menus, it is more beautiful than the UL dry, but unordered list more common, UL replaces menu.

Layer and DIV elements are similar, but only work in the old version of Netscape browser, not very useful.

Blink or Marquee. Firmly say no to them.

Font, which you can use to define the name, size, and color of the font. The old site (and even now) uses the font label continuously throughout the page, just like the termite disaster. Some from web page creation software, which arranges font labels around each element to control text color or size. With the font tag applied to each element, the use of CSS to express a simple sentence can be, but also the whole station to implement changes. Using this method, not only can reduce the volume of web pages, change a simple CSS statement can change the content of the font. This keeps the website style consistent. Font labels and misuse forms are the main reasons why pages are bulky.

Attribute Attributes

Now you may use labels correctly, but they have some annoying parasitic properties that can lead to stale.

Name assigns a name to the element, which is perfect in form elements such as input, but elsewhere, the work of name is replaced by the id attribute.

Text and bgcolor are used to specify the base text color and the background color with the open Body label. The color and Background-color properties in CSS can be well applied to the body selector.

Background can specify a background picture for the body tag. CSS can provide better background image properties, such as Background-image.

Link,alink,vlink can specify the link color for the body tag. CSS properties:: link,:active,:visited 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 opens in a different state, such as opening a new window <a href= "wherever.html" target= "_blank" >help me</a>. Sounds good, but there is no intimacy with the site. Users do not expect these (such as new windows) to appear like magic, and most users prefer to use the back button, and opening a new window means that the feature is disabled. The performance properties of the label, such as the width of the picture and the cellpadding and cellspacing of the height table, determine that different attributes are applied to different elements. They are not the perfect solution, but if your page has a lot of pictures or tables, you may not have other options available.

Most inexplicable performance attributes belong to the textarea tag, which is not only cols and rows valid attributes, but the latest HTML standard requires them.

Good tags, bad apps.

Enter your house, you may kneel to drill a dog hole, but wait, there is a specially designed for the door decoration-handle, hehe, see, the door has the right to pass the correct size.

HTML tags are precisely designed for details, trust or distrust, and when you use them correctly, you can achieve the best results.

When HTML is semantic, Web pages bring more ease to users with disabilities, such as screen readers often emphasize lists it uses to the UL tag or a title it uses to H1 or H2 tags.

The most serious misuse of HTML is tables, tables are used for layout, but they are only used to represent tabular data. The idea of not using tabular layouts is not as inspiring as Buddhists, and it has real benefits, not only in reducing the volume of pages, but also in maintaining and redesigning Web pages easily.

Sometimes some designers use some tags and attributes to complete the transitional design (especially the table layout), one is to support the old version of the browser (Netscape 4). The Netscape 4 table is better than CSS, but its users are very small and decreasing, and now the number of mobile users is increasing and the table layout is very bad. The advantages of the table mentioned above are far from being a drawback because the page needs to take into account the capabilities of all browsers in as few styles as possible.

Frame Frames
Goldilocks thought it was a very good idea to help her with a bowl of porridge, but then three large predators appeared and threw her out the window. The frame is like a bowl of porridge belonging to a bear. They look good, but dangerous moments exist.

Most Web sites do not use frames, and most web users have only a single page.

But if, for some reason, you need to prevent users from adding a specific page to their bookmarks, or you want to prevent specific pages that are introduced via email or instant messaging, or you want to add another level of overall complexity to disabled users who use screen readers, who need to navigate between frames, Or if you want to go to search engine hell, use the framework.

Basically, the framework does nothing but add complexity and loss of usability.

Finally, if you follow the rules below, it will not be too wrong.

1 if the name of the label or attribute is relatively uncommon, it is recommended to comment, or not to use it. This will improve the efficiency of using CSS.

2 Let the label do the job that matches its name. The table is used in tabular data. The title is the title, and so on.

3 When you have specific content, use the appropriate label. List with list, title with title, and so on.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.