About font-weight | https://www.codecademy.com/paths/web-development/tracks/styling-a-website/modules/learn-css-selectors-visual-rules/lessons/css-visual-rules/exercises/font-weight-i

When i used font-weight in p tag in css as bold, it worked fine, but when i write font-weight in body tag, nothing changed. isn’t all body font suppose to change in bold ?

Hey there! :slightly_smiling_face:

In the future when you post please include your code formatted. Hit this button:

Then copy/paste your code between the two rows of backticks:


If you change the font-weight of a parent container, than yes, normally all of its children will inherit the same property. In your picture it looks like the <p> element is indeed bold. If you are referring to the <h1> and <h2> elements not changing with the font-weight that is because headers are already set by default to bold and as such won’t inherit something different from their parents.
To change them, you will have to refer to that element , its class, or its id:

<h1 class="h1" id="h1"> Text </h1>


h1 {
  // Styles with elements name
}

.h1 {
  // Styled with elements class
}

#h1 {
  // Styles with elements ID
}
1 Like

Thank you for your reply :+1:

1 Like