Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Am I applying onClick correctly?

This is my first time trying to apply a onClick to a transformation in css. I'm not sure why it's not working though. What am I doing wrong?

<!DOCTYPE html>
<html>
<head>
  <style type="text/css">
      .flipit { 
          width: 500px; 
          height: 200px;
          margin: 10px; 
          float: left;
      }
      .flipit > .front { 
          onClick="clickity()";
          position: absolute;
          transform: perspective( 800px ) rotateY( 0deg );
          background: aqua; width: 240px; height: 200px; border-radius: 7px; 
          backface-visibility: hidden;
          transition: transform 1s linear 0s;
      }
       .flipit > .back { 
          onClick="clickity()";
          position: absolute;
          transform: perspective( 800px ) rotateY( 180deg );
          background: red; width: 240px; height: 200px; border-radius: 7px; 
          backface-visibility: hidden;
          transition: transform 1s linear 0s;
    <script>
          function Clickity () { 
          transition: transform: perspective( 800px ) rotateY( 180deg );   
    </script>
      }
     /* .flipit:hover > .front { 
          transform: perspective( 800px ) rotateY( -180deg );
      }
      /*.flipit:hover > .back {
          transform: perspective( 800px ) rotateY( 0deg );
      }
   </style>
    </head>
<body>
    <div class="flipit">
        <div class="front">Front Face</div>
        <div class="back">Back Face</div>
    </div>
</body>
</html>

Thanks!

You are mixing JavaScript in with your CSS. onClick is a JavScript event, it is not CSS. http://www.w3schools.com/jsref/event_onclick.asp

looks like Clickity on your scripts tag should be lowercase and have no space between clickity and parentheses. Like this

<script>
      function clickity() { 
      transition: transform: perspective( 800px ) rotateY( 180deg );   
</script>