HTML Img Alt Tags For SEO Best Practice - Search Engines Love ...
Có thể bạn quan tâm
Contents
- 1 Code Example
- 2 The alt text
- 3 The alt description — Users
- 4 The alt description — Search Engines
- 5 Learn more about alt
- 6 Values of the alt Attribute
- 7 All Attributes of img Element
- 8 Browser Support for alt
Code Example
<img src="/wp-content/uploads/flamingo.jpg" alt="Pink flamingo.">
The alt text
The alt attribute will accept any text string, but there are certain best practices that will help.
- No special characters. This includes UTF-8 characters such as unencoded curly quotes, as well as HTML Character Entities.
- No HTML.
- No more than 125 characters.
- Just identify the picture. No need to refer to it (“This is a picture of…”).
The alt description — Users
The alt attribute provides an “alternative description” for the image. This description is normally not presented to the user, but will be under certain circumstances:
- Assistive technology — If the user is visually impaired, and is using a screen reader, the screen reader will read the alt description to the user.
- Images turned off — Some users prefer to surf the web with images turned off (to save bandwidth or to minimize distraction). These users will normally see the alt description instead of the image.
- Image failure — If an image fails to load for any reason (bad file name, connection problems), the user will usually see the alt description in place of the image.
Here’s an example of displaying the alt text in place of a failed image (the image src points to nothing).
<img src="not-a-real-file-name.jpg" alt="Depending on your browser, you might see this message in place of the failed image.">
The alt description — Search Engines
The alt description is also very helpful for search engines. Search engines have a hard time figuring out what the content of an image actually is. They are getting better at it, but identifying the subject of a photo or picture is extremely difficult. So search engines rely on the alt description to know what is actually in a picture (they also use the file name and other attributes). Additionally, in Google Image Search, the alt description is actually shown to the user.
Learn more about alt
How much more is there to know about alt? A lot. We’ve put together this tutorial on the Rules of Alt to help you out.
Values of the alt Attribute
| Value Name | Notes |
|---|---|
| text | Specifies alternative text to be displayed in particular contexts. |
All Attributes of img Element
| Attribute name | Values | Notes |
|---|---|---|
| height | Identifies the intrinsic height of an image file, in CSS pixels. | |
| srcset | list of sources | Defines multiple sizes of the same image, allowing the browser to select the appropriate image source. |
| align | right left | Was previously used to specify the alignment and placement of an image relative to the surrounding text. It has been deprecated and should not be used. |
| alt | text | Defines alternate text, which may be presented in place of the image. |
| border | pixels | Previously used to define a border on an image element. It has been deprecated and should no longer be used. |
| controls | Toggled media player controls when used in conjunction with the <code>dynsrc</code> attribute. Both attributes are now deprecated. | |
| dynsrc | ||
| hspace | Previously used to add horizontal space on both side of an image. It is now deprecated. | |
| ismap | Identifies an image as a server-side image map. When the containing anchor link is clicked, the coordinates of the mouse will be included in the request. | |
| longdesc | Defines a URL at which can be found more information about the image. It was written out of the HTML5 specification, but its status is not quite so clear as other deprecated features. | |
| loop | Previously used to specify the number of times a video should play, when used in conjunction with the dynsource attribute. Both attributes have been deprecated. | |
| lowsrc | Specified a smaller or lower-quality version of an image. | |
| name | Identified the image or provided additional information about it. Deprecated in HTML 4.0 in favor of other attributes. | |
| naturalsizeflag | This attribute does nothing. It was once used by a proprietary software system. | |
| nosave | Was intended to prevent users from downloading an image. Was never a part of the HTML specification, and not widely implemented. | |
| start | fileopen mouseover | |
| suppress | Used by the now-defunct Netscape browser to suppress the display of image prior to image download completion. | |
| usemap | Specifies a client-side image map to be used with the image. | |
| width | Indicates the intrinsic width of the image, in CSS pixels. | |
| src | Specifies the URL of an image to be displayed. |
Browser Support for alt
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| All | All | All | All | All | All |
Từ khóa » Html Image Alt Text Color
-
How To Style Alt Text Color? - Html - Stack Overflow
-
Quick Tip: Remember To Style Your ALT Text - Web Design
-
HTML Img Alt Attribute - W3Schools
-
Style Alt Text - CodePen
-
The Ultimate Guide To Styled ALT Text In Email - Litmus
-
Image ALT Tag Tips For HTML - Accessibility At Penn State
-
Should Color Be Included In Alt Text? - DEV Community
-
An Alt Decision Tree | Web Accessibility Initiative (WAI) - W3C
-
Mastering Styled Alt Text In Email - Email On Acid
-
t - Web APIs | MDN
-
How To Change Color Of Alt Text In Css?
-
What Is Image Alt Text? - Allyable
-
Alternate Text For Background Images, Alt Text Accessibility
-
Writing Useful Alt Text - CSS { In Real Life }





