Please help is needed in Step 14

How do I use a single selector to center the h1, h2 and p element at the same time?

 <style>
      h1 {
        text-align: center;
      }
      h2 {
        text-align: center;
      }
      p {
        text-align: center;
      }
      h1, h2 and p {text-align: center; }
    </style>

Which course is this for?

Building a Cafe Menu

The example in the instructions shows you how you can have multiple selectors for the same rule:

selector1, selector2 {
  property: value;
}

This means that both the elements caught by selector1 and the elements caught by selector2 will have their property set to value.

The instructions are asking you to combine the three individual rules for h1, h2 and p into one rule following the pattern above.

I am really confused on how to use the single type selector. I have written the elements caught by selector 1 and the elements caught by selector2. I have also set their property to value. I know I am not doing it right. I really need help on this.


    <style>
      h1 {
        text-align: center;
      }
      h2 {
        text-align: center;
      }
      p {
        text-align: center;
      }
     text-align : center {value;}
      </style>

Yes, you have, but they are each in their own separate rule. This step wants you to combine them into one rule. So instead of having a separate rules for h1, h2, and p, you will instead just have one rule that combines them all. So it will look something like this:

??? {
  text-align:center;
}

You have to fill in the “???”.

1 Like

I finally got it. I just dug deep and really listened to the instruction. Thank you so much

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.