HTML tutorial: title attribute and alt attribute _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
XHTML is the foundation of CSS layout. webjx.com has always emphasized the knowledge of XHTML and emphasized the structure of semantics and documents. The title and alt attributes give me the most intuitive feeling that they can improve the adaptability of documents and increase the keyword density reasonably. In the XHTML standard, the alt attribute of the image is required. Xhtm xhtml is the foundation of CSS layout. jb51.net has always emphasized the knowledge of XHTML and emphasized the structure of semantics and documents. The title and alt attributes give me the most intuitive feeling that they can improve the adaptability of documents and increase the keyword density reasonably. In the XHTML standard, the alt attribute of the image is required.
XHTML is the foundation of CSS layout. jb51.net has always emphasized the knowledge of XHTML and emphasized the semantics and document structure. The title and alt attributes give me the most intuitive feeling that they can improve the adaptability of documents and increase the keyword density reasonably. In the XHTML standard, the alt attribute of the image is required.
Alt attribute
For a user agent (UA) that cannot display images, forms, or applets, the alt attribute is used to specify the replacement text. The language used to replace text is specified by the lang attribute. Alt attributes (note that they are "attributes" rather than "tags") include replacement instructions, which are required for images and image hotspots. It can only be used in img, area, and input elements (including applet elements ). For the input element, the alt attribute is intended to replace the image of the submit button.
For example, the alt attribute is used to provide text descriptions for those who cannot see the images in your document. This includes users who use browsers that do not support image display or that are disabled, users with visual impairment, and users who use screen readers. Replace text is used to replace images rather than provide additional instructions.
Think carefully before writing and replacing the text to ensure that the text does provide instructions for those who cannot see the image and make sense in the context. For decorative images, you can use null values (alt = "", there is no space in the quotation marks) instead of irrelevant replacement text such as "blue bulletaskcharacter spacer.gif ". Do not ignore it. If you ignore it, some screen readers will directly read the file names of image files, and those text browsers, such as Lynx, will display the file names of image files, and it will be useless for your viewers.
It is easiest to replace text with an image that contains text. text contained in an image can generally be used as an alt attribute value.
Title attribute
The title attribute provides information about the creation period for the element that sets this attribute.
The title attribute can be used for all tags except base, basefont, head, html, meta, param, script, and title. But it is not necessary. Maybe that's why many people don't understand when to use it.
Use the title attribute to provide non-essential additional information. Most visualization browsers display the title text as a prompt message (tool tip) When hovering the cursor over a specific element. However, the manufacturer decides how to render the title text. Some browsers will display the title text in the status bar. For example, an earlier version of Safari browser.
The title attribute has a good purpose, that is, to add descriptive text for the link, especially when the connection itself is not very clear about the purpose of the link. In this way, visitors will know where the links will take them, and they will not load a page that may not be completely interested. Another potential application is to provide additional descriptive information for images, such as dates or other non-essential information.
The title attribute value can be longer than the alt attribute value. However, some browsers may truncate too long text (such as tooltip or other ). For example, the Mozilla core browser can only display the first 60 characters. This is considered a Mozilla bug, which you should pay attention.
Related Article

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.