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

HTML form_PowerNode Java Academy

1. Form 1. The role of the form HTML forms are us...

W3C Tutorial (15): W3C SMIL Activities

SMIL adds support for timing and media synchroniz...

Summary of MySQL usage specifications

1. InnoDB storage engine must be used It has bett...

Teach you how to deploy Vue project with Docker

1.Write in front: As a lightweight virtualization...

Methods and steps to access Baidu Maps API with JavaScript

Table of contents 1. Baidu Map API Access 2. Usin...

mysql5.7.20 installation and configuration method graphic tutorial (mac)

MySQL 5.7.20 installation and configuration metho...

How to solve the element movement caused by hover-generated border

Preface Sometimes when hover pseudo-class adds a ...

How to quickly modify the host attribute of a MySQL user

When you log in to MySQL remotely, the account yo...

Detailed explanation of this reference in React

Table of contents cause: go through: 1. Construct...

Nodejs uses readline to prompt for content input example code

Table of contents Preface 1. bat executes js 2. T...

After docker run, the status is always Exited

add -it docker run -it -name test -d nginx:latest...

Summary of Linux Logical Volume Management (LVM) usage

Managing disk space is an important daily task fo...

DHTML objects (common properties of various HTML objects)

!DOCTYPE Specifies the Document Type Definition (...