Questions tagged [css-transforms]

CSS transforms allow elements styled with CSS to be transformed in two-dimensional or three-dimensional space

The CSS transform property allows developers to rotate, scale, and skew blocks of HTML via CSS. Although the same effect can be accomplished with images in Photoshop or The GIMP, using CSS transforms allows developers to do the same thing with any HTML markup and allows users to select the text within the transformed object.

Example

/* Keyword values */    
transform: none;    

/* Function values */    
transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);    
transform: translate(12px, 50%);    
transform: translateX(2em);    
transform: translateY(3in);    
transform: scale(2, 0.5);    
transform: scaleX(2);    
transform: scaleY(0.5);    
transform: rotate(0.5turn);    
transform: skew(30deg, 20deg);    
transform: skewX(30deg);    
transform: skewY(1.07rad);    
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);    
transform: translate3d(12px, 50%, 3em);    
transform: translateZ(2px);    
transform: scale3d(2.5, 1.2, 0.3);    
transform: scaleZ(0.3);    
transform: rotate3d(1, 2.0, 3.0, 10deg);    
transform: rotateX(10deg);    
transform: rotateY(10deg);    
transform: rotateZ(10deg);    
transform: perspective(17px);    

/* Multiple function values */    
transform: translateX(10px) rotate(10deg) translateY(5px);    

/* Global values */    
transform: inherit;    
transform: initial;    
transform: unset;    

Documentation :

2502 questions
821
votes
9 answers

How to apply multiple transforms in CSS?

Using CSS, how can I apply more than one transform? Example: In the following, only the translation is applied, not the rotation. li:nth-child(2) { transform: rotate(15deg); transform: translate(-20px,0px); }
Ben
  • 15,938
  • 19
  • 92
  • 138
175
votes
8 answers

Prevent flicker on webkit-transition of webkit-transform

Possible Duplicate: iphone webkit css animations cause flicker For some reason, right before my animation of the webkit-transform property occurs, there is a slight flicker. Here is what I am doing: CSS: #element { -webkit-transition:…
devongovett
  • 4,850
  • 5
  • 34
  • 35
175
votes
21 answers

Position fixed doesn't work when using -webkit-transform

I am using -webkit-transform (and -moz-transform / -o-transform) to rotate a div. Also have position fixed added so the div scrolls down with the user. In Firefox it works fine, but in webkit based browsers it's broken. After using the…
iSenne
  • 2,656
  • 5
  • 26
  • 26
155
votes
10 answers

'transform3d' not working with position: fixed children

I have a situation where, in normal CSS circumstances, a fixed div would be positioned exactly where it is specified (top:0px, left:0px). This does not seem to be respected if I have a parent that has a translate3d transform. Am I not seeing…
Juan Carlos Moreno
  • 2,754
  • 3
  • 22
  • 21
150
votes
7 answers

Rotated elements in CSS that affect their parent's height correctly

Let's say I have a couple of columns, of which some I'd like to rotate the values of: http://jsfiddle.net/MTyFP/1/
Normal
Chris
  • 9,994
  • 3
  • 29
  • 31
126
votes
4 answers

Rotate and translate

I'm having some problems rotating and positioning a line of text. Now it's just position that works. The rotation also works, but only if I disable the positioning. CSS: #rotatedtext { transform-origin: left; transform: rotate(90deg); …
Sera
  • 1,367
  • 2
  • 8
  • 8
117
votes
4 answers

use multiple css filters at the same time?

I am experimenting with css filters. And I would like use the blur and grayscale at the same time, but I can't seem to use both simultaneously on the same image? See fiddle here... http://jsfiddle.net/joshmoto/fw0m9fzu/1/ .blur { filter:…
joshmoto
  • 1,650
  • 2
  • 14
  • 21
91
votes
9 answers

Hover effect : expand bottom border

I'm trying to get a transition hover effect on border that the border expands on hover. h1 { color: #666; } h1:after { position: absolute; left: 10px; content: ''; height: 40px; width: 275px; border-bottom: solid 3px…
Vivekraj K R
  • 2,418
  • 2
  • 19
  • 38
85
votes
2 answers

CSS transform doesn't work on inline elements

I wanted to mirror letter E in the word WEBLOG so I used CSS transform property but it doesn't work if I wrap the text inside a span but it works if I assing display: inline-block; or display: block; So transforms doesn't apply to inline…
Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
85
votes
6 answers

Why does enabling hardware-acceleration in CSS3 slow down performance?

I am moving 10,000 small div elements in a css3 experiment from the top of the browser viewport to the bottom. For this test I use 2 different approaches: With GPU acceleration using translate3D(x, y, z) or translateZ(0) No GPU acceleration by…
Timo Ernst
  • 15,243
  • 23
  • 104
  • 165
84
votes
9 answers

How to prevent Webkit text rendering change during CSS transition

I'm using CSS transitions to transition between CSS transformed states (basically transitioning the scale of an element). I notice that when the element is transitioning, the rest of the text on the page (in Webkit) tends to slightly alter its…
RussellUresti
  • 6,211
  • 4
  • 28
  • 26
83
votes
4 answers

Why does applying a CSS-Filter on the parent break the child positioning?

So I have this title-screen "animation" that has the title centered on a fullscreen page and when you scroll down it becomes smaller and remains at the top of the page. Here is a working example with the expected behavior, from which I stripped all…
leonheess
  • 16,068
  • 14
  • 77
  • 112
81
votes
4 answers

rotate3d shorthand

How to combine rotateX(50deg) rotateY(20deg) rotateZ(15deg) in shorthand rotate3d()?
Artem Svirskyi
  • 7,305
  • 7
  • 31
  • 43
75
votes
4 answers

translate3d vs translate performance

We now all know, particularly from that nice article, that we should prefer css-transforms to animate position. But we got the choice between translate() and translate3d()... Which one is generally faster?
abernier
  • 27,030
  • 20
  • 83
  • 114
75
votes
3 answers

CSS Transform with element resizing

I found this: width/height after transform and several others, but nothing is not quite what I'm looking for. What I want is to scale something to 50% of it's size (with nice animated transition of course) and have the page layout re-adjust to the…
Gus
  • 6,719
  • 6
  • 37
  • 58
1
2 3
99 100