Monday, 07 November 2011 06:47

How to Create Transition Effects using CSS3 Featured

Written by Chris Jacoby

By using the latest version of web browsers, such as Firefox, Chrome, Safari and Internet Explorer, you always get little enhancements and always have the latest technology available. One of these technologies includes CSS3 capabilities.

CSS3 is the new kid on the block in the web design world and has mostly been around since 2009. It offers exciting new possibilities to create an impact with your designs, allowing you to use more diverse style sheets for a variety of occasions and lots more.

One of the CSS3 capabilities is transitions. CSS3 transitions are effects that let an element gradually change from one style to another.

To use these transitions in your code, you must specify two things:

  • Specify the CSS property you want to add an effect to
  • Specify the duration of the effect.

Example

Transition effect on the width property, duration: 1 second:

 

#id_of_element {

-webkit-transition: all 1s ease-in-out;

-moz-transition: all 1s ease-in-out;

-o-transition: all 1s ease-in-out;

-ms-transition: all 1s ease-in-out;

transition: all 1s ease-in-out;

}

Note: If the duration is not specified, the transition will have no effect, because default value is 0.

The effect will start when the specified CSS property changes value. A typical CSS property change would be when a user mouse-over (:hover) an element:

#id_of_element:hover {

-webkit-transition: all 1s ease-in-out;

-moz-transition: all 1s ease-in-out;

-o-transition: all 1s ease-in-out;

-ms-transition: all 1s ease-in-out;

transition: all 1s ease-in-out;

}

Example

example3example2example1

 

Fading menu item gradually from dark grey to light grey.

Here are a few other CSS3 elements that you can go and explore:

  • User Interface – box sizing, resize, outline
  • Borders – colors, images, radius and shadows
  • Backrounds – size, multiple
  • Colors – opacity and color variants
  • Text Effects – shadows, overflows and word wrapping

To learn more about CSS3 visit http://www.css3.info/

Last modified on Monday, 07 November 2011 07:36
Chris Jacoby

Chris Jacoby

Chris is an Information Systems Engineer who has great experience with the online web world. His strengths lie in website application development, user friendly website design and development, graphics design and website optimization. 

Nothing is impossible! ~Chris


E-mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Add comment



Call Us: +27 11 612 7460