Error: Invalid CSS after "}": expected "}", was "" on line 41 of main.scss >> } ^


#1

I got a similar message too.

Error: Invalid CSS after "}": expected "}", was "" on line 41 of main.scss >> } ^

Here is my code:

@import url(https://fonts.googleapis.com/css?family=Pacifico);
//Add variables here:

h1 {
font-family: Roboto, sans-serif;
text-align: center;
}

.banner {
font-family: 'Pacifico', cursive;
height: 400px;
background-image: url("lemonade.jpg");
border : {
top: 4px solid black;
bottom: 4px solid black;
}

.slogan {
position: absolute;
border: 4px solid black;
top: 200px;
left: 25%;
width: 50%;
height: 200px;
text-align: center;
}
span {
font-size: 24px;
line-height: 200px;
}

.container {
text-align: center;
font-family: 'Pacifico', cursive;
}
.icon {
display: inline-block;
margin: 2%;
border: 4px solid black;
font-size: 32px;
}

Other then having trouble nesting the border selector inside the banner class, it works fine.


I got this message: Error: Invalid CSS after "{": expected 1 selector or at-rule
#2

You are missing the closing } for your .banner selector. It should look like this:

.banner {
  font-family: 'Pacifico', cursive;
  height: 400px;
  background-image: url("lemonade.jpg");
  border : {
    top: 4px solid black;
    bottom: 4px solid black;
  }
  .slogan {
    background-color: $translucent-white;
    position: absolute;
    border: 4px solid black;
    top: 200px;
    left: 25%;
    width: 50%;
    height: 200px;
    span {
      position: absolute;
      text-align: center;
      line-height: 200px;
    }
  }
}

#3

Thanks, I tried but I still had the error message.
I just clicked get the code and compared with my code. I haven't found any difference except "background-color: $translucent-white;" line, so maybe that cause the error.


#4

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