CSS3 Selectors: ID selectors

This entry is part 6 of 40 in the series CSS3 Selectors

What makes attributes of type ID special is that no two such attributes can have the same value in a document.

An ID typed attribute can be used to uniquely identify its element.

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
        #city {
            font-family: sans-serif;
            color: purple;
            font-weight: bold;

<h2>Taylor Swift</h2>

<p>Taylor Swift moved to <span id='city'>Nashville</span>, Tennessee, at the age of 14 to pursue a career in country

Series Navigation<< CSS3 Selectors: Class selectors
CSS3 Selectors: The > selector >>
Posted in