티스토리 뷰

HTML의 img 태그에는 alt 속성이 있다. 종종 alt속성의 의미를 망각하고 tooltip 처럼 사용하는 경우가 있는데 이는 MSIE에서 alt에 지정된 텍스트를 tooltip 텍스트로도 보여주기 때문이다. 하지만 alt속성은 이미지를 보여줄 수 없는 lynxw3m과 같은 텍스트 브라우저에서 이미지 대신 보여주기 위한 텍스트일 뿐 tooltip용 메시지를 넣는 곳이 아니다.

Mozilla Web Author FAQ에서는 왜 모질라에서 alt속성을 tooltip으로 보여주지 않는지에 대한 이유를 적어놨다.
  • When the alternative text is shown in a tooltip, some authors write bad alt texts, because they intend the text as auxiliary tooltip text and not as a replacement for the image. (‘Bad’ in the sense that the textual alternative is less useful for people who don’t see the image.)

  • When the alternative text is shown in a tooltip, other authors don’t want to supply textual alternatives at all, because they don’t want tooltips to appear. (Again, making things harder for people who don’t see the image.)



요점은 주어진 기능은 목적에 맞게 쓰자는 것이다. tooltip 메시지를 지정하기 위한 속성은 따로 있다. title 속성이 바로 그것인데 title 속성은 브라우저, 좀 더 폭넓게 얘기하자면 유저에이전트(user agent)에 따라 다르게 보여질 수 있는데 일반적으로 이미지를 지원하는 브라우저라면 tooltip의 형태로 나타나게 되고 음성을 지원하는 브라우저라면 음성의 형태로 나타날 수 있다.

아마도 alt와 title에 들어갈 메시지가 동일한 경우도 있을 수 있다. 브라우저에서 이미지의 또 다른 표현 형태에 대해 신경을 많이 쓰지 못하면 대충 alternative text와 tooltip을 동일한 문구로 넣는 경우도 있을 수 있는데 그렇다 하더라도 alt속성은 그 나름대로 생겨난 이유가 있고 title속성 역시 나름대로 생겨난 이유가 있는 속성들!.. 그 목적에 맞게 각각 적어주자.
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함