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

#id {
    /* declarations */

# Example

#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.0) Yes (1.0) Yes (1.0) Yes (12.0) Yes (3.0) Yes (2.0)
Mobile Yes (1.0) Yes (1.0) Yes (1.0) Yes (12.0) Yes (3.0) Yes (2.0)

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