Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,274 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,274 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.