{ LearnWebSiteDesign.com }
HTML, XHTML CSS Tutorials and Free Website Templates
CSS Transitions Tutorial
This tutorial will cover CSS3 transitions that are practical to use across different web browsers. At the moment, not all web browsers support CSS3 transitions. On the date that this tutorial was written, only webkit browsers (Google Chrome and Apple's Safari) support CSS3 transitions.
Normally when the value of a CSS property changes, the affected elements immediately change from the old property value to the new property value. When CSS transition properties are applied, the change from the old value to the new value happens in a smooth, animated manner over a period of time, which you can specify.
Text Link Transitions
The code below shows you how to apply a simple color change when the cursor is hovered over the text link.
The results of the CSS styles above when applied to a text link is shown below.
Now I will add the CSS3 styles to add the transition effect. Notice that the CSS3 transitions styles are applied to the "a" selector and not the "a:hover" selector.
Notice the CSS property, -webkit-transition. The -webkit prefix specifies that the property is specifically made to work only in Webkit browsers (Google Chrome and Apple Safari). Other web browsers also have their own specific CSS properties to allow support for CSS3 transitions whenever they are made available in each respective browser.
The results of the CSS styles above when applied to a text link is shown below.
After the declaration of the CSS3 transition property, the values of the declaration are: "color 1s ease-in". This is a shorthand declaration. The values represent:
- The property to be transitioned
- The duration of the transition
- The type of transition
In this case, we transition using ease-in, which will begin the transition slowly, and speed up into the transition.
Transition Properties
The table below lists the CSS transition properties.
| Property | Description | CSS Level |
| transition | A shorthand property to set the four transition properties in one property | 3 |
| transition-property | Specifies the name of the CSS property to which the transition will be applied | 3 |
| transition-duration | Specifies the length of time that the transition takes. The default is 0 | 3 |
| transition-timing-function | Specifies the speed during the transition from one value to another. The default is ease | 3 |
| transition-delay | Defines when the transition will start. Default 0 | 3 |
Background Transitions
CSS3 transitions allow you to change the background color of an HTML element from one color value to a new color value.
The results of the CSS styles above when applied to a text link is shown below.
A practical and useful use of CSS3 transitions is to apply the transition property to input fields. The example below shows you how to have the background of color of an input field transition to a new background color.
The code above produces the input field below.
Combining Multiple CSS Transition Properties
CSS allows you to combine multiple transition properties using the longhand versions of the CSS3 transition properties.
The example below shows you how to have the color of the text transition from black to red, with a duration time of 1 second and a timing function of linear. The background color of the text transitions from yellow to blue, with a duration time of 2 seconds and a timing function of linear.
The CSS code above produces the text link below when the styles are applied the selectors "a" and their hover state "a:hover".
Tutorials
Templates
References
Sponsors
You can get your website online using Velnet, a leading UK web hosting provider. They provide free template and installation for WordPress blogs. Discuss webmaster related topics at Webmaster Serve, a Webmaster SEO forum
SouthernWebGroup.com provides high quality website design in Atlanta, GA as well as around the world.
Find low cost cheap website hosting and domain registration.
Browser our free no ads web hosting directory and find the free web hosting that's right for you and your budget.
Advertise your web design and web development related products and services here.
- Web Hosting UK
- Web Design Manchester
- Cheap Web Hosting
- free website hosting reviews
- ecommerce design
- Advertise
Recommended
Download free css web hosting templates that are easy to edit at FreeWebHostingTemplates.com.
Friends
- free web hosting templates
- free web hosting templates
- free web hosting reviews
- Web Development
- HD Wallpapers
- best web hosting providers
- Web Hosting Blog
- domain names
- iPage Host Reviews
- Reliable Bluehost Reviews
- Programming Forum
- Alojamento Web
- criar sites
- Free Facebook Banners
- Free No Ads Web Hosting Reviews
- Cheap Web Hosting Reviews
- Free Web Hosting Templates
- Free Premium Wordpress Themes
- Free Premium Wordpress Themes
- Free Joomla Template
- Free Wordpress Themes
- Best Android Apps
- Wordpress Themes Gallery
- Information technology courses
- Free PSD Files