Skip to content

Challenge Style Multiple Elements with a CSS Class

SaintPeter edited this page · 1 revision
Clone this wiki locally

You can attach classes to HTML elements by using class="your-class-here" within the relevant element's opening tag.

CSS selectors require a period at the beginning like this: .blue-text { color: blue; }, but that class declaration in the HTML doesn't use a period, like this: <h2 class="blue-text">CatPhotoApp<h2>.

<style>
  .red-text {
    color: red;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
Something went wrong with that request. Please try again.