HTML <img> 대체 속성

❮ HTML <img> 태그

예시

대체 텍스트가 지정된 이미지:

<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">

정의 및 사용

필수 alt속성은 이미지를 표시할 수 없는 경우 이미지에 대한 대체 텍스트를 지정합니다.

속성 은 alt어떤 이유로 사용자가 이미지를 볼 수 없는 경우(느린 연결, src속성의 오류 또는 사용자가 화면 판독기를 사용하는 경우) 이미지에 대한 대체 정보를 제공합니다.

팁: 이미지에 대한 툴팁을 만들려면 title속성을 사용하세요!


브라우저 지원

Attribute
alt Yes Yes Yes Yes Yes

통사론

<img alt="text">

속성 값

Value Description
text Specifies an alternate text for an image.

Guidelines for the alt text:

  • The text should describe the image if the image contains information
  • The text should explain where the link goes if the image is inside an <a> element
  • Use alt="" if the image is only for decoration

❮ HTML <img> 태그