Alt text (alt attribute trên <img>) mô tả nội dung ảnh cho:
- Search engines — Google không 'nhìn' ảnh, dùng alt text để hiểu ảnh và rank trên Google Images,
- Screen readers — người khiếm thị nghe mô tả ảnh,
- Fallback — hiển thị khi ảnh không load được
Cách viết tốt: mô tả cụ thể, ngắn gọn (125 ký tự), chứa keyword tự nhiên (không keyword stuffing).
Ví dụ tốt: alt='Golden retriever puppy playing fetch in park'.
Ví dụ xấu: alt='dog', alt='image1.jpg', alt='best dog training tips buy now click here'.
Khi nào để trống (alt=''): decorative images không mang thông tin (icons, dividers, background patterns). Ảnh text (infographic, banner): alt text nên chứa text trong ảnh.
Alt text (the alt attribute on <img>) describes image content for:
- Search engines — Google cannot visually 'see' images; it uses alt text to understand them and rank on Google Images,
- Screen readers — visually impaired users hear the image description,
- Fallback — displayed when an image fails to load
How to write good alt text: be specific and concise (under 125 characters), include keywords naturally (no keyword stuffing).
Good example: alt='Golden retriever puppy playing fetch in park'.
Bad examples: alt='dog', alt='image1.jpg', alt='best dog training tips buy now click here'.
When to leave it empty (alt=''): decorative images that carry no information (icons, dividers, background patterns).
For text images (infographics, banners): the alt text should include the text shown in the image.