ID 선택자
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
CSS ID 선택자는 요소의 id
특성 값을 비교하여, 완전히 동일한 id
를 가진 요소를 선택합니다.
css
/* id="demo" 요소 선택 */
#demo {
border: red 2px solid;
}
구문
#id_value { style properties }
위의 구문은 특성 선택자를 사용한 다음 구문과 동일합니다.
[id=id_value] { style properties }
예제
>CSS
css
#identified {
background-color: skyblue;
}
HTML
html
<div id="identified">특별한 ID를 가진 요소에요!</div>
<div>이건 그냥 div에요.</div>
결과
명세
Specification |
---|
Selectors Level 4> # id-selectors> |
브라우저 호환성
Loading…