Trouble with subheadings in css visual rules


#1

I am on lesson 3 in css visual rules and I am having trouble understanding how to add the font family of the main heading h1 and subheading h2. Can anyone please explain how to do this to me so that I am not stuck here.


#2

Please link to the exercise. Thanks.

Is the main section a class, or a type?

<div class="main">
  <h1>Top level heading</h1>
  <h2>Secondary heading</h2>
</div>

Or,

<main>
  <h1>Top level heading</h1>
  <h2>Secondary heading</h2>
</main>

Either way, the selectors will be similar, but not the same.

main h1,
main h2 {
    font-family: Garamond, serif;
}

Or,

.main h1,
.main h2 {
    font-family: Garamond, serif;
}

The font-family above is arbitrarily chosen for the example.

Notice how the selectors have a space before the h1 and before the h2. That is because the headings are children, that is, descendants of their parent container. The selector is known as a descendant combinator.


#4

Thank you, You have really helped me get unstuck. I thought it may have been something simple that I was missing.


#5

Link, please. We do not have the thousands of lessons in the courses on speed-dial.


#6

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