CSS

#navigation-menu {

color: red;

text-align: left;

}

In this example, the one div with the id of ‘navigation-menu’ will have the style applied. This direct targeting approach allows us to isolate individual elements that have a unique style. This increased level of control offers us the ability to take control of and fine-tune our design as per our requirements.

Class selector

The class selector is equally as straightforward as the id selector – we just need to substitute the ‘#’ for a ‘.’ Selecting a class will update all HTML elements that contain that class. As explained in the HTML section, classes can and should be used across multiple elements. By adding a class to a selection of elements, you are able to target and apply a style to those elements all at once. Let’s see an example of how this might be used in the wild: