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

General Discussion Unused CSS Stages Transitions and Transforms Transitions - WebKit Only

Nazaam Kutisha
Nazaam Kutisha
7,667 Points

CSS code challenge Help me out on this please.

[http://teamtreehouse.com/library/websites/css-foundations-second-edition/transitions-and-transforms/transitions-webkit-only]

Code Challenge: Using the prefix for WebKit-based browsers, create a transition for the border-radius property of .box. Give the transition a duration of 2 seconds, a delay of 1 second, and a timing function that maintains a linear motion.

I have the web kit prefix and the duration and delay values set correctly I don't see why response isn't accepted.

-webkit-transition: margin 2s cubic-bezier(.5, -.5, .3, 1.3) 1s, background .6s linear 1s;
transition: margin 1s cubic-Bezier(.5, -.5, .3, 1.3) 0s, background .6s linear 1s;

3 Answers

Okay. Here's the css that they gave us to start:

.box {
    border-radius: 15px;
    background: #4682B4;
 }

.box:hover {
    background: #F08080;
    border-radius: 50%;
}

Okay. The border-radius on our .box div is 15px. That just gives each corner of our box a little 15 pixel curve.

The border-radius when a user hovers their cursor over the .box div ( .box:hover ) is 50%. That turns our square box into a circle. Review here: http://teamtreehouse.com/library/css-foundations/backgrounds-and-borders/border-radius-3 if needed.

Right now, if a user hovers their cursor over the .box div, there is no smooth transition. It just instantly flashes from being a box with slightly rounded corners to being a circle. You can go to the preview and check that out, if you want.

So, they want us to style the .box div so that if it's asked to transition from { border-radius: 15px } to something else, it shouldn't just instantly flash to the new styling.

In long-hand, we could do it this way.

Code Challenge: using the prefix for webkit based browsers, create a transition for the border-radius property of .box

.box {
      -webkit-transition-property: border-radius;
}

give the transition a duration of 2s

    -webkit-transition-duration: 2s;

a delay of 1s

    -webkit-transition-delay: 1s;

and a timing function that maintains a linear motion.

-webkit-transition-timing-function: linear;

But we can put all this into one line. So here's the answer with the stuff that they already had in there for us.

.box {
  border-radius: 15px;
  background: #4682B4;
 -webkit-transition: border-radius 2s linear 1s;
}

Again, you can go to the preview and check out the smooth transition from square to circle.

Nazaam Kutisha
Nazaam Kutisha
7,667 Points

Hi Gary, I was able to get it to work finally. Beautiful job explaining that.