CSS Selector Level 1 » ID

This ID selector is selecting (none or) one element that has a given id attribute; because the element with the ID has to be unique.

# Syntax

Copy
#id {
    /* declarations */
}

# Example

Copy
#header {
    border: 1px solid black;
}

This example will add a black border around the <div> with the #header ID.

Try example in CodePen

# Browser support

Platform Chrome Firefox Safari Edge Internet Explorer Opera
Desktop Yes (1) Yes (1) Yes (1) Yes (12) Yes (3) Yes (2)
Mobile Yes (1) Yes (1) Yes (1) Yes (12) Yes (3) Yes (2)

Please wait a moment, the comments start loading now...
explorermozillachromesafariopera info external