css3 animation effect
.transition{
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease ;
transition: all .5s ease;
}
Here I just want to apply the transform attribute as follows:
-webkit-transform: translateX(20px);
How should I write it? The following writing method does not take effect!
-webkit-transition: transform .5s ease;
-webkit-transform
should be similar How to write
div
{
transform: translate(50px,100px);
-ms-transform: translate(50px,100px); /* IE 9 */
- webkit-transform: translate(50px,100px); /* Safari and Chrome */
-o-transform: translate(50px,100px); /* Opera */
-moz-transform: translate(50px, 100px); /* Firefox */
}
You seem to need a trigger event
CSS3 IE compatible code online conversion IE's CSS3 Transforms Translator
Demo code
.trans { width: 100px; height: 100px; background-color: yellow;}.trans:hover {/* W3C CSS3 standard */ transform: translateX(20px); /* Firefox */ -moz-transform: translateX(20px); /* webkit (Chrome, Safari, mobile browsers, etc) */ -webkit-transform: translateX(20px); /* Opera */ -o-transform: translateX(20px); /* IE>=9 */ -ms-transform: translateX(20px); /* IE8+ - must be on one line, unfortunately */ -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22=1, SizingMethod='auto expand')"; /* IE6 and 7 */ filter: progid:DXImageTransform.Microsoft.Matrix( M11=1, M12=0, M21=0, M22=1, SizingMethod='auto expand'); /* * To make the transform-origin be the middle of * the object. Note: These numbers * are approximations. For more accurate results, * use Internet Explorer with this tool. */ margin-left: 7px; margin-top: -3px; }
Demo updated version
Added transition