HTML TutorialLesson 24Free preview
HTML Id
This lesson is part of HTML · All levels
Summary
The id attribute is used to uniquely name an element within a page. The value of id must not be duplicated to remain valid, and in CSS is written with a hash such as #header. id is also useful as a link anchor and to be reached by JavaScript.
Key points
- The id must be unique, only used once per page
- Selected in CSS with the # mark, example: #header
- Used as a link anchor as href="#bagian2"
- Easily manipulate elements with JavaScript
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.