Use the CSS Transform scale Property to Scale an Element on Hover 2

Use the CSS Transform scale Property to Scale an Element on Hover 2
0.0 0

#1

Tell us what’s happening:
I been stuck on this challenge for over an hour and I passed it 15 minutes ago however I can’t replicate what I did. I wasn’t expecting it to pass it when I hit entered. What am I doing wrong?

Your code so far


<style>
  div { 
    width: 70%;
    height: 100px;
    margin:  50px auto;
    background: linear-gradient(
      53deg,
      #ccfffc,
      #ffcccf
    );
  
    div: hover {
      transform: scale(1.1);
    }
  }
  
  
  
</style>

<div class="hover"></div>

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/use-the-css-transform-scale-property-to-scale-an-element-on-hover


#2

only one thing was that u created class hover for div without needing it.


#3

you need to remove the space between after div and you also need to move div:hover outside div {. In CSS you can only style one thing at a time.

 div { 
    width: 70%;
    height: 100px;
    margin:  50px auto;
    background: linear-gradient(
      53deg,
      #ccfffc,
      #ffcccf
    );
  }

   div:hover {
      transform: scale(1.1);
    }

You would need to use something like SASS to support nesting, in which case you could do it like this:

 div { 
    width: 70%;
    height: 100px;
    margin:  50px auto;
    background: linear-gradient(
      53deg,
      #ccfffc,
      #ffcccf
    );
  
    &:hover {
      transform: scale(1.1);
    }
  }

#4

I deleted the class and it still doesn’t work.


#5

Thanks so much. I didn’t think the spaces will prevent it from working.