Back to Freecodecamp

Step 9

curriculum/challenges/english/blocks/workshop-cafe-menu/5f3477ae34c1239cafe128be.md

latest1.3 KB
Original Source

--description--

You now have three type selectors with the same styling. You can add the same group of styles to many elements by creating a list of selectors. Each selector is separated with commas like this:

css
selector1, selector2 {
  property: value;
}

Delete the three existing type selectors and replace them with one selector list that centers the text for the h1, h2, and p elements.

--hints--

You should use a single type selector for all three elements, h1, h2, p. Be sure to use that order.

js
const hasSelector = new __helpers.CSSHelp(document).getStyle('h1, h2, p');
assert.exists(hasSelector);

You should only have one selector in your style element.

js
const selectors = new __helpers.CSSHelp(document).getCSSRules().filter(x => x.selectorText)
assert.equal(selectors.length, 1);

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Cafe Menu</title>
    <style>
--fcc-editable-region--
      h1 {
        text-align: center;
      }
      h2 {
        text-align: center;
      }
      p {
        text-align: center;
      }
--fcc-editable-region--
    </style>
  </head>
  <body>
    <main>
      <h1>CAMPER CAFE</h1>
      <p>Est. 2020</p>
      <section>
        <h2>Coffee</h2>
      </section>
    </main>
  </body>
</html>