You can create a name for a specific group of elements and then you can apply a style.
Create a class
Create a style for this class
You can create a name for a specific element and then you can apply a style.
I am KRONOS
Pseudo-classes permit formatting based on element’s state and not on information that lies on the document tree(tags). They should always be applied to an existing selector and you use: and then the name. Here is a good list of pseudo-classes.
The above pseudo-class and its property will make the anchor’s link background color brown when the mouse hover it.
Target a nested element
You can also target a specific element or elements, by writing the whole tree of the elements. For example you have an anchor tag inside a paragraph tag
You can target this anchor tag only by writing in order the tags separated with space.
Here is the whole html:
and the CSS file:
As you can see there are 2 styles for a tag, and they have different background-color. The second one that is more specific it has priority.
Just remember that a more specific rule always wins. More specific means that the rule target less elements. If two rules are the same then the latest loaded wins.