ID Selectors
index.html
style.css
An ID selector in CSS allows you to target a single, unique element on your page. To use an ID selector, add an id attribute to an HTML element, then reference that ID in your CSS by prefixing it with a hash (#). For example, if an element has id="main-title", you select it in CSS with #main-title.
Each ID value must be unique within a page—no two elements should share the same ID. This uniqueness helps ensure that the styles you apply with an ID selector affect only the intended element. ID selectors are commonly used for elements that need a specific, one-off style or for elements you want to reference directly in scripts or navigation.
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Awesome!
Completion rate improved to 6.67
ID Selectors
Glissez pour afficher le menu
index.html
style.css
An ID selector in CSS allows you to target a single, unique element on your page. To use an ID selector, add an id attribute to an HTML element, then reference that ID in your CSS by prefixing it with a hash (#). For example, if an element has id="main-title", you select it in CSS with #main-title.
Each ID value must be unique within a page—no two elements should share the same ID. This uniqueness helps ensure that the styles you apply with an ID selector affect only the intended element. ID selectors are commonly used for elements that need a specific, one-off style or for elements you want to reference directly in scripts or navigation.
Merci pour vos commentaires !