CSS3 Transition

No comments

Use CSS 3 transition to give action to elements in your website, such as change in colour, motion and more!

CSS3 Transition

The basic syntax for creating a css transition is “property”, “duration”, and “type”.

If we take the following example (transition:color 1s ease-in;) – the property we are changing is the color, over a duration of 1 second and using the ease-in method). See below some examples of how this can be implemented into your projects.

CSS3 Colour Transition Example


Mouse over this example paragraph to see it fade to a new colour using a basic CSS3 transition.

  1. CSS3 Transition (color)
  2. .my_class {
  3. transition: color .5s ease-in;
  4. -moz-transition: color .5s ease-in;
  5. -o-transition: color .5s ease-in;
  6. -webkit-transition: color .5s ease-in;
  7. }
  8. .my_class:hover {
  9. color:#066;
  10. }

This is a good technique for creating mouseover actions for links and buttons.


Mouse over this example paragraph to see it rotate 7degrees using a transform transition.

  1. CSS3 Transition (transform)
  2. .my_class {
  3. transition: transform .5s ease-in;
  4. -moz-transition: -moz-transform .5s ease-in;
  5. -o-transition: -o-transform .5s ease-in;
  6. -webkit-transition: -webkit-transform .5s ease-in;
  7. }
  8. .my_class:hover {
  9. transform: rotate(7deg);
  10. -moz-transform: rotate(7deg);
  11. -o-transform: rotate(7deg);
  12. -webkit-transform: rotate(7deg);
  13. }

This can be used to create a more interactive website, such as menu items or image gallery.


No comments :

Post a Comment