Minimize Code

To group selectors, separate each selector with a comma. In the example below, the selectors from the code on the previous page have been grouped:

HTML file: Displayed by browser:
<style>
h1, h2, p {
   text-align: center;
   color: purple;
}
</style>
<body>
  <h1>Hello World!</h1>
  <h2>Smaller Heading.</h2>
  <p>This is a paragraph.</p>
</body>

Hello World!

Smaller Heading.

This is a paragraph.

Wow, now that is certainly is a reduction of your coding, isn't it? I'm beginning to see now, that I will have to revamp all of my homework files!

Back buttonTable of ContentsNext button