CSS transition and animate or transform with multiple properties

Transition:

The transition attribute can be used to create simple animations on a web page, you can use it to make the browser fade between two states and more. You have to specify the properties you'd lie to animate or you can specify 'all' which will tell it to just animate every property change. An example usage can be seen below, note that you need to place a comma between the properties that you want to transition/animate and also the need to specify a time for the transition, this can be integer or decimal:

-moz-transition: transform 1s, opacity 1s;
-o-transition: transform 1s, opacity 1s;
-webkit-transition: transform 1s, opacity 1s;
transition: transform 1s, opacity 1s;

You don't have to specify the -o-, -webkit- and -moz- properties but it does provide limited backward support for older browsers.

See w3schools for more on transitions.

Transform:

Transform works just like the transition attribute, the example seen below moves the element down 6px and rotates the element to a 45 degree angle, note that unlike the transition property, you do not need to place a comma between different transforms.

-moz-transform: translate(0, 6px) rotate(45deg);
-ms-transform: translate(0, 6px) rotate(45deg);
-o-transform: translate(0, 6px) rotate(45deg);
-webkit-transform: translate(0, 6px) rotate(45deg);
transform: translate(0, 6px) rotate(45deg);

Again, you don't have to specify the -o-, -webkit- and -moz- properties but it does provide limited backward support for older browsers.

See w3schools for more on transforms.


By Luke Alderton at 18 Jan 2016, 10:39 AM

Tags: CSS3

Comments

Post a comment
Sit tight...
We're adding your comment.
Thank you.
Your comment has been added.
There's been a problem.
Please try again later.
Share with
Tags
Latest Comments
By dipbleds on Raspberry Pi - Bluetooth using Bluecove on Raspbian
12 Dec 2017, 21:29 PM
By Ich on Replacing the Xamarin Header/Navigation bar with a custom view/template
26 Nov 2017, 17:11 PM
By Ravi Motha on My experience at Umbraco UK Festival 2017
12 Dec 2017, 08:39 AM
By Borges on How to add a Xamarin Forms Loading Screen/Overlay
7 Nov 2017, 19:11 PM
By Rutul Mehta on Auto/Custom height on Xamarin Forms WebView for Android and iOS
4 Nov 2017, 03:15 AM
By Pablo on Xamarin MasterDetailPage has large margin/padding at top
26 Oct 2017, 15:31 PM
By faiza on Using MaryTTS or OpenMary in Java
22 Oct 2017, 12:54 PM
By Nietoperz on Using MaryTTS or OpenMary in Java
29 Sep 2017, 14:34 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development