Weird thing with styling in Basic CSS lesson

Weird thing with styling in Basic CSS lesson
0

Hello Community,

While giving a hand of help one of the campers seems that I’ve found the bug in one of the lessons of Basic CSS.

Link to the lesson: https://learn.freecodecamp.org/responsive-web-design/basic-css/give-a-background-color-to-a-div-element/

To pass the lesson I have do the following things:

  1. add style silver-background inside the style tag
  .silver-background {
    background-color: silver;
  }
  1. add class sivler-background to my div tag
   <div class="silver-background">
      ....
   </div>

If I do the things as I've described above then all the styles are applied and everything works fine. BUT if I do the first step in the following way (add white space between the parameter and the colon):
  .silver-background {
    background-color : silver;
  }

With the code above the look of the page will not be changed, but I won’t be able to pass the last task Define a class named silver-background within the style element and assign the value of silver to the background-color property.

This seems to be a buggy behavior and should be fixed, because if I do the same trick with white space in this (randomly chosen lesson) - https://learn.freecodecamp.org/responsive-web-design/basic-css/style-the-html-body-element

The code is:

<style>
body {
background-color : black;
}
</style>

Then all three tasks are marked as passed and I can continue to learn the CSS.

So, it looks like there is a bug in the validation of the last task in the https://learn.freecodecamp.org/responsive-web-design/basic-css/give-a-background-color-to-a-div-element/ lesson.

the difference is between tests that check what you have written, and tests that check what’s the property on a certain element, without caring how the property arrived there
when the tests check exactly what you have written, they expect you to not put a space between the rule and the two dots, it is the accepted standard on how to write the rules

anyway, if you think it is a bug…
Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.