CSS IDs
CSS IDs target a unique element using id="name" and #name. IDs must be unique per page.
IDs have very high specificity, making them harder to override with other selectors.
CSS IDs target a unique element using id="name" and #name. IDs must be unique per page.
IDs have very high specificity, making them harder to override with other selectors.
<header id="site-header">
<nav>...</nav>
</header>
/* CSS */
#site-header {
position: sticky;
top: 0;
background: white;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
Reserve IDs for JavaScript targeting or anchor links; use classes for all visual styling.