ID 선택자
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
CSS ID 선택자는 요소의 id
특성 값을 비교하여, 완전히 동일한 id
를 가진 요소를 선택합니다.
css
/* id="demo" 요소 선택 */
#demo {
border: red 2px solid;
}
구문
예제
CSS
css
#identified {
background-color: skyblue;
}
HTML
html
<div id="identified">특별한 ID를 가진 요소에요!</div>
<div>이건 그냥 div에요.</div>
결과
명세
Specification |
---|
Selectors Level 4 # id-selectors |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ID selector ( #idName ) |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.