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 CSS Transitions and Transforms Getting Started with CSS Transitions Transitioning Multiple Properties

Transition not smooth

I have following css , but my input doesn't get smooth transition.

*{
    background: #2980B9;
}
input[type="text"]{
    background:#3498DB;
    padding:5px;
    border:0;
    border-radius: 0.5em;
    transition-property: background;
    transition-delay:5s;
}
input[type="text"]:focus{
    background: #2C3E50;
}

1 Answer

Jesus Mendoza
Jesus Mendoza
23,289 Points

Hey Ammar.

You need to specify the duration

transition-duration: .5s;

You can shorten your properties to one line

transition: background 5s .5s;

Jesus Mendoza why use css 5s .5s`

Jesus Mendoza
Jesus Mendoza
23,289 Points

Writing

transition: background 5s .5s;

is the same as

transition-property: background;
transition-delay: 5s;
transition-duration: .5s;

but in only one line of code.