HTML Tutorial: title attribute and alt attribute

HTML Tutorial: title attribute and alt attribute

XHTML is the basis of CSS layout. jb51.net has always emphasized the learning of XHTML knowledge and paid attention to semantics and document structure. The most intuitive feeling I get from the title and alt attributes is that they can improve the adaptability of the document and reasonably increase the keyword density. In the XHTML standard, the alt attribute of images is required.
XHTML is the basis of CSS layout. jb51.net has always emphasized the learning of XHTML knowledge and paid attention to semantics and document structure. The most intuitive feeling I get from the title and alt attributes is that they can improve the adaptability of the document and reasonably increase the keyword density. In the XHTML standard, the alt attribute of images is required.
alt attribute <br />For user agents (UA) that cannot display images, forms, or applets, the alt attribute is used to specify alternative text. The language of the replacement text is specified by the lang attribute. Alt attributes (note the word "attribute" and not "tag") contain alternate descriptions and are required for images and image hotspots. It can only be used in img, area, and input elements (including applet elements). For input elements, the alt attribute is intended to be used to replace the submit button's image.
For example: Use the alt attribute to provide text descriptions to viewers who cannot see the images in your document. This includes users who use browsers that don't natively support image display or have image display turned off, users with visual impairments, and users who use screen readers. Alt text is used to replace images rather than provide additional description text.
Think carefully before writing alt text to make sure it actually provides information for people who can’t see the image and that it makes sense in context. For decorative images, use an empty value (alt="" with no spaces between the quotes) instead of using irrelevant alt text like "blue bullet" or "spacer.gif". Don't omit it, if you do some screen readers will read the image filename directly, and text browsers like Lynx will display the image filename, which is not useful to your viewers.
It is easiest to set alternative text for images that contain text. The text contained in the image can generally be used as the alt attribute value.
The title attribute provides advisory information for the element on which it is set.
The title attribute can be used in 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 nonessential additional information. Most visual browsers display the title text as a tool tip when the mouse hovers over a specific element, but it is up to the manufacturer to decide how to render the title text. Some browsers will display the title text in the status bar. For example, early versions of the Safari browser.
A good use of the title attribute is to add descriptive text to a link, especially when the link itself doesn't clearly convey the purpose of the link. This lets visitors know where the links will take them, so they don't load a page that they may not be interested in. Another potential application is to provide additional captions for images, such as dates or other non-essential information.
The title attribute value can be longer than the alt attribute value. Be aware, though, that some browsers will truncate long text (like tooltips or whatever). For example, Mozilla-based browsers can only display the first 60 characters. This is considered a Mozilla bug, and is something you should be aware of.

<<:  Echarts sample code for using multiple X-axes to achieve seven-day weather forecast

>>:  How to install tomcat8 in docker

Recommend

Simple implementation of mini-vue rendering

Table of contents Preface Target first step: Step...

Detailed explanation of Linux mpstat command usage

1. mpstat command 1.1 Command Format mpstat [ -A ...

jQuery implements employee management registration page

This article example shares the specific code of ...

How to expand the disk space of Linux server

Table of contents Preface step Preface Today I fo...

Detailed explanation of three methods of JS interception string

JS provides three methods for intercepting string...

Detailed explanation of Docker working mode and principle

As shown in the following figure: When we use vir...

Vue implements a movable floating button

This article example shares the specific code of ...

How to quickly clean up billions of data in MySQL database

Today I received a disk alarm exception. The 50G ...

Detailed tutorial on how to monitor Nginx/Tomcat/MySQL using Zabbix

Table of contents Zabbix monitors Nginx Zabbix mo...

How to modify the contents of an existing Docker container

1. Docker ps lists containers 2. Docker cp copies...

js realizes the dynamic loading of data by waterfall flow bottoming out

This article shares with you the specific code of...

Install Docker environment in Linux environment (no pitfalls)

Table of contents Installation Prerequisites Step...

Detailed explanation of Nginx's rewrite module

The rewrite module is the ngx_http_rewrite_module...