freeCodeCamp.org

code1:
span:not(.sr-only){
font-weight:normal;
}

code2:
span.description{
font-weight:normal;
}

Will both code1 and code2 serve the same purpose?

Hi @sandeep.gohain91

The answer will depend on what the css values are for the span elements, and .sr-only and .description classes, and the purpose you are looking for.

Consider the following code.

<span>Test</span>
<span class="sr-only">Test</span>
<span class="description">Test<span>

span {
  color: red;
}

span:not(.sr-only) {
  font-weight:normal;
  color: yellow;
}

span.description {
  font-weight:normal;
  color: green;
}

The first span element will have red text.
The second span element will have yellow text.
The third span element will have green text.

Also, the default font-weight is normal, so no change may appear.

Happy coding