Lesson: HTML5 and CSS
Style Multiple Elements with a CSS Class
Remember that you can attach classes to HTML elements by using class="your-class-here"
within the relevant element's opening tag.
Remember that CSS class selectors require a period at the beginning like this:
.blue-text {
color: blue;
}
But also remember that class declarations don't use a period, like this:
<h2 class="blue-text">CatPhotoApp</h2>
Apply the red-text
class to your h2
and p
elements.
The content on this page is licensed under Attribution-ShareAlike 4.0 International. Original authors: freeCodeCamp, the content was modified.