Prev Page Next Page
Top

CSS Transitions

➢CSS transitions allows you to change property values smoothly, over a given duration.
➢transition
➢transition-delay
➢transition-duration
➢transition-property
➢transition-timing-function

EXAMPLE:

div {
     width: 5%;
     height: 100px;
     background: green;
     transition: width 4s;

}

div:hover {
     width: 100%;

}

RESULT:

Run


EXAMPLE:

div {
     transition: width 4s, height 6s;

}

RESULT:

Run


Specify the Speed Curve of the Transition

➢The transition-timing-function property specifies the speed curve of the transition effect.
The transition-timing-function property can have the following values:
ease - specifies a transition effect with a slow start, then fast, then end slowly (this is default)
linear - specifies a transition effect with the same speed from start to end
ease-in - specifies a transition effect with a slow start
ease-out - specifies a transition effect with a slow end
ease-in-out - specifies a transition effect with a slow start and end
cubic-bezier(n,n,n,n) - lets you define your own values in a cubic-bezier function

EXAMPLE:

#div1 {
     transition-timing-function: linear;

}

#div2 {
     transition-timing-function: ease;

}

#div3 {
     transition-timing-function: ease-in;

}

#div4 {
     transition-timing-function: ease-out;

}

#div5 {
     transition-timing-function: ease-in-out;

}

Run


Delay the Transition Effect

➢The transition-delay property specifies a delay (in seconds) for the transition effect.

EXAMPLE:

div {
     transition-delay: 1s;

}

RESULT:


Transition + Transformation

➢The transition-delay property specifies a delay (in seconds) for the transition effect.

EXAMPLE:

div {
     transition: width 2s, height 2s, transform 2s;

}

RESULT:

Run


Prev Page Next Page





FEEDBACK

Rating


Message