Knowee
Questions
Features
Study Tools

We want to apply different styles to the 3 different <h1>'s on this page. What selectors should we use?CHOOSE ALL OF THE ANSWERS THAT WILL WORK.<body>    <header>        <h1>I am a heading</h1>    </header>    <h1>I am a heading too</h1>    <main>        <section>            <h1>A third heading on the same page</h1>        </section>    </main></body>  body>h1 { ... }header>h1  { ... }section>h1  { ... }  header h1  { ... }header+h1  { ... }main h1  { ... }  body h1   { ... }header>h1   { ... }section>h1  { ... }  body+h1  { ... }header>h1   { ... }section>h1  { ... }  body h1   { ... }header>h1   { ... }main>h1  { ... }

Question

We want to apply different styles to the 3 different <h1>'s on this page. What selectors should we use?CHOOSE ALL OF THE ANSWERS THAT WILL WORK.<body>    <header>        <h1>I am a heading</h1>    </header>    <h1>I am a heading too</h1>    <main>        <section>            <h1>A third heading on the same page</h1>        </section>    </main></body>  body>h1 { ... }header>h1  { ... }section>h1  { ... }  header h1  { ... }header+h1  { ... }main h1  { ... }  body h1   { ... }header>h1   { ... }section>h1  { ... }  body+h1  { ... }header>h1   { ... }section>h1  { ... }  body h1   { ... }header>h1   { ... }main>h1  { ... }

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The selectors that will work are:

  1. header>h1 { ... } - This will select the <h1> that is a direct child of <header>.
  2. body>h1 { ... } - This will select the <h1> that is a direct child of <body>.
  3. section>h1 { ... } - This will select the <h1> that is a direct child of <section>.
  4. header h1 { ... } - This will select any <h1> that is a descendant of <header>.
  5. main h1 { ... } - This will select any <h1> that is a descendant of <main>.
  6. body h1 { ... } - This will select any <h1> that is a descendant of <body>.

The selectors header+h1 { ... }, body+h1 { ... }, and main>h1 { ... } will not work because they are trying to select an <h1> that is a sibling of <header>, <body>, and <main> respectively, or a direct child of <main>, but there are no such elements in the HTML structure provided.

This problem has been solved

Similar Questions

How do you apply a style to all <h1> elements in CSS?0.5 Marks#h1 {}all.h1 {}h1 {}.h1 {}

Question 6For the following HTML code, which CSS selectors can be used to select the h1 element? Select all that apply.1<h1 id="title">Welcome</h1>

body>h1 { ... }header>h1  { ... }section>h1  { ... }  header h1  { ... }header+h1  { ... }main h1  { ... }  body h1   { ... }header>h1   { ... }section>h1  { ... }  body+h1  { ... }header>h1   { ... }section>h1  { ... }  body h1   { ... }header>h1   { ... }main>h1  { ... }

Which of the following selections is the proper way to apply this CSS rule:.blue { color: blue }a. <p color = "blue">b. <p class = "blue">c. <p color = .blue>d. <p class = .blue>

Which heading style consider as a base text in HTML?Answer areaH1H6H4H2

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.