IR(Image Replacement)기법은 이미지의 대체 텍스트를 제공하기 위한 CSS기법을 사용하여 이미지의 대체 텍스트를 제공할 수 있다. 즉, 눈에 보이는 디자인만 이쁘게 해서 설계하는 것이 아니라, 스크린리더기 사용자에게도 편리하게 이용할 수 있게 해야되기 때문에 적절히 IR기법을 사용해야 된다.
text-indent
를 이용하여 화면 바깥으로 -9999px만큼 빼내에 보이지 않게 하는 방법..ir_pm {
display: block;
overflow: hidden;
font-size: 0;
line-height: 0;
text-indent: -9999px;
}
<span>
요소로 감싼 후 z-index: -1;
를 속성을 이용하여 화면에 보이지 않게 처리한다.ir_wa{
position: relative;
display: block;
overflow: hidden;
z-index: -1;
width: 100%;
height: 100%;
}
.ir_su{
position: absolute;
overflow: hidden;
width: 0;
height: 0;
line-height: 0;
text-indent: -9999px;
}
<label>
을 사용할 때 설명하기 위한 텍스트도 사용해야 되고 디자인도 해야되는 경우, 내가 가장 종종 쓰는 CSS Class이다..a11y-hidden {
overflow: hidden;
position: absolute;
clip: rect(0 0 0 0); /* IE 6,7 */
clip: rect(0,0,0,0);
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
}
caption.a11y-hidden {
position: static;
}
.a11y-hidden.focusable:focus {
overflow: visible;
position: static;
clip: auto;
width: auto;
height: auto;
margin: 0;
}