Your .blog-post element should have a color of red. Your h2 elements should have a color of red

Your .blog-post element should have a color of red. Your h2 elements should have a color of red
0.0 0

#1

Tell us what’s happening:
I am getting error as below, Please help

Your .blog-post element should have a color of red.
Your h2 elements should have a color of red.

Your code so far


<style type='text/sass'>
$text-color: red;

.header{
  text-align: center;
}
.blog-post h2 {
color: $text-color;
}
</style>

<h1 class="header">Learn Sass</h1>
<div class="blog-post">
  <h2>Some random title</h2>
  <p>This is a paragraph with some random text in it</p>
</div>
<div class="blog-post">
  <h2>Header #2</h2>
  <p>Here is some more random text.</p>
</div>
<div class="blog-post">
  <h2>Here is another header</h2>
  <p>Even more random text within a paragraph</p>
</div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/sass/store-data-with-sass-variables/


#2

.blog-post h2 {<- This is incorrect.


#3

@ArielLeslie

can you plz help me with correct code.


#4

What have you tried besides the code above? What led you to try just putting two identifiers before a definition, separated by a space?


#5

it was seperated with a comma, still the same.

i also tried these.

.blog-post, h2 {
color: $text-color;
}
.blog-post, p {
color: $text-color;
}


#6

A comma can be used to apply a style to multiple classes, but I don’t believe that you can use it to apply a style to both a class and an element. The blog-post class and h2 element need their own style declarations. You aren’t asked to do anything with p elements.


#7

it was predefined like below, i just created variable $text-color and set it to red, and changed the value of red.

.header{
text-align: center;
}
.blog-post, h2 {
color: red;


#8

Ok. Apparently you can use a comma with both classes and elements. All you need to do from to the code that FCC provides is create the variable and change red to the variable name. You don’t need to change any selectors and don’t remove the comma.


#9

do you mean this,

$text-color: red;

.header{
text-align: center;
}
.blog-post, h2 {
color: $text-color;
}


#10

Yes. That should pass the tests.


#11

no, still im getting same error.

Error:
Your .blog-post element should have a color of red.
Your h2 elements should have a color of red.


#12

I can’t reproduce your error. Please create a GitHub Issue. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible. Please include your browser version and list any browser extensions you may be using.


#13

Just fyi some of the Sass challenges, including this one are a bit buggy, what you’ve got there is correct. I asked about it on github and they directed me to this thread, said they’re working on refactoring it: https://github.com/freeCodeCamp/freeCodeCamp/issues/12699


#15

Sure, will do that.

Thank you


#16

oh k , so what you did next.


#17

Just skip it and go to another challenge.


#18

There is no skip option. :frowning:


#19

Just use the curriculum page to go to whatever challenge you want to do next.