8. Multiple Clas-ses: HTML


#1

Hi everyone,
I need help with https://www.codecademy.com/courses/learn-html-css/lessons/ids-classes-divs/exercises/multiple-classes-html?action=lesson_resume&link_content_target=interstitial_lesson (8. Multiple Classes: HTML).
I don't understand the example;
.book {
font-family: Georgia, serif;
}

.domestic {
font-color: #0902CC;
}

.foreign {
font-color: #B097DD;
}
The classes are: book domestic & book foreign, so how...
And why when i wrote in the title "classes" it's say "Title contains the following censored words: a-s-s" :slight_smile:


#2

HTML elements can have 2 classes:

h1 and h2 both have the class "book". h1 has 2 classes assigned: "book" & "domestic". h2 has 2 classes assigned "book" & "foreign"

When you set a style for the .book it will change both h1 and h2 since they both have that class.

When you set a style for domestic it will apply that style to only h1.

Same goes for if you set a style for foreign it will only apply to h2 in the example.


#3

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