본문으로 건너뛰기

ID Selector

ID Selector

The HTML id is a selector used to uniquely identify specific HTML elements.

Multiple HTML elements cannot have the same id.

The id is mainly used to assign a unique identifier to a specific element, to select and manipulate that element in CSS or JavaScript.

An id selector can be defined as follows with a #.

HTML id usage example
<style>
#intro {
font-size: 24px;
font-weight: bold;
color: green;
}
</style>

<p id="intro">Welcome</p>

Thus, you can select the HTML element with the id of intro using #intro, and apply styles that are unique to this HTML element.

Note that ids are case-sensitive. That is, Intro and intro are different ids.

However, it is conventional to use lowercase for ids.

다음 내용이 궁금하다면?

월 12,500원 PLUS 멤버십 가입 or 강의를 등록해 주세요!