Multiple Classes

So I’ve been studying the basics with CSS and don’t quite understand multiple classes.

For example my heading needs to be red and bold. in CSS the rule would be:
.red {
color: red;}

.bold {
font-weight: bold;}

in HTML the code would be -
< h1 class=“red bold”> Im learning to code

This seems to work fine in JS fiddle. However when I try and add a third into the class (such as font-size 18px or font-family it doesn’t work.

Surely it is easier to have class=“headline”> Breaking News!
.headline {
font-family: Arial;
font-size: 20 px;
color: purple;
and then you can customise the headline as many times as you want to how you want it to look?

1 Like

have a great time and good luck enjoy


I have also a question regarding multiple classes as Ayecahn97 (sorry, but I don’t have a solution/reply to your question).

I have done both HTML and CSS short course before and I’m doing it on the Code Academy just to refresh my memory and to repeat the information. I’m currently in the step 8 - Multiple Classes, but I find the suggested coding really confusing. In my previous course, I was taught that it is best to do everything in regards to layout in the CSS and not HTML. I was taught before that you give a name to the class in HTML and when you assign color, font weight etc through the CSS.

Is multiple classes is an older way to code or is it something new :)? Does anybody have any comment on it?