Write a selector with 2 classes


#1

Hi, how can I write selectors that use two classes? The tip shows “write by separating each selector with a space.”

There is a p element with a class of citation, then an a element inside of it with a class of external-link.
I need to make this external-link into a different color: SeaGreen;

Thanks


#2

A selector points to a node element. More correctly, a node element is a selector. It is declarative. A style sheet selector points to a specific node or group of nodes.

A node is any element in the document tree. The tree begins with the <html> element with in the document type declaration is the root element. The base of the tree. The document grows out from there.

There are a number of ways that two classes can come into play…

.class1.class2 {}

The browser interprets this as a class1 that is also class2.

 .class1 .class2 {}

The browser interprets this a 'class1that *contians* aclass2`.

.class1, .class2  {}

The browser interprets this a .class1 or a .class2.


#3

Awesome! It worked with .class1 .class2 {}
Thank you mtf :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.