์น์ ๊ทผ์ฑ์ ์ํ ํ ์คํธ ์จ๊น ์ฒ๋ฆฌ(blind text)
์ฌ์ฉ์ด์ !
display: none
์ด ์๋ ์ ๊ทผ์ฑ์ ๊ณ ๋ คํด ์จ๊น์ฒ๋ฆฌํ๋ค.
.hide {
position: absolute;
top: -9999px;
left: -9999px;
text-index: -9999px;
width: 1px;
height: 1px;
}
์์ ๊ฐ์ ๊ฒฝ์ฐ ์ ๊ทผ์ฑ์ ๋ฌธ์ ๋ฅผ ์ผ์ผํจ๋ค.
text-indent
์ ๊ฒฝ์ฐ, ์ต์ปคํํฌ(<a href="/">
)๋ html5์์ ๋ํํ ์์๋ค์์ ์ด์ ์ document ๋ฐ์ ์ก์๋ฒ๋ฆฌ๋ ๋ฌธ์ ์ ์ด ์๋ค.
๋ณด์ด์ง ์๋ ๊ณณ์ ์ด์ ์ด ๋๊ฐ๋ ๊ฒ์ ์ ๊ทผ์ฑ์ ์๋ฐ๋๋ฏ๋ก, ์จ๊นํ ์คํธ๋ฅผ ์ฌ์ฉํ๊ณ ์ ํ ๋ ๋ถ์ ํฉํ๋ค.
.blind {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
}
// ์คํ์ผ ์ค๋ช
/*
1) position:absolute;
- ๋ ์ด์์์ ์ํฅ ๋ฏธ์น์ง ์๊ธฐ ์ํด์น์ง ์๊ธฐ ์ํด
2) overflow:hidden;
- ์์์ ํฌ๊ธฐ๋ฅผ ๋ฒ์ด๋๋ ์ฝํ
์ธ ์จ๊ธฐ๊ธฐ ์ํด
3) width, height: 1px;
- ๋์ด์ ๋์ด ์ต์(1px)ํ์ฌ ์คํฌ๋ฆฐ๋ฆฌ๋๊ธฐ๊ฐ ์ธ์ํ ์ ์๋๋ก ํ๋ค.
4) margin:-1px;
- ์์์ ํฌ๊ธฐ๋งํผ ์ญ๋ง์ง์ ์ฃผ์ด ์์ ์ฐจ์งํ๋ ๊ณต๊ฐ ์ ๊ฑฐ
5) clip: rect(0, 0, 0, 0);
- ์์๊ฐ ํ๋ฉด์ ๋ณด์ด๋ ์์ญ์ 0์ผ๋ก ์ง์
6) clip-path: inset(50%);
- clip ํธํ์ฑ์ ์ํด ์ถ๊ฐ
*/
ํ๋ ๊ฒ์ด ์ข๋ค.
Reference
[21.12.21 ์ถ๊ฐ]
https://webaim.org/techniques/css/invisiblecontent/#techniques
WebAIM: CSS in Action - Invisible Content Just for Screen Reader Users
CSS in ActionInvisible Content Just for Screen Reader Users You are here: Home > Articles > CSS in Action: Invisible Content Just for Screen Reader Users Article Contents Introduction Techniques for hiding text Examples Instructional cues and indicators "S
webaim.org
์น ์ ๊ทผ์ฑ์ ๊ณ ๋ คํ๋ฉฐ HTML ์์ ์จ๊ธฐ๊ธฐ
์ ๊ทผ์ฑ '๋ค์ด๋ฒ ์ ๊ทผ์ฑ'์์ ์ธ์ฉํ ์ ๋ณด ์ ๊ทผ์ฑ์ ์ ์๋ ๋ค์๊ณผ ๊ฐ๋ค. ์ ๋ณด ์ ๊ทผ์ฑ์ ๋ชจ๋ ์ฌ์ฉ์๊ฐ ํน์ ํ๊ฒฝ์ด๋ ์ ์ฒด์ ์ฅ์ ์ ์๊ด์์ด ์น ์ฌ์ดํธ๋ ์ ํ๋ฆฌ์ผ์ด์ ์์ ์ ๊ณตํ๋ ๋ชจ๋ ์
omins.tistory.com