CSS scaleX() Function
Example
Use scaleX() to scale the width of several <div> elements:
#myDiv1 {
transform: scaleX(0.7);
}
#myDiv2 {
transform:
scaleX(90%);
}
#myDiv3 {
transform: scaleX(1.1);
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The CSS scaleX()
function is used to scale
an element horizontally.
The scaleX()
function increases or decreases the
width of an element.
The scaleX()
function is used within the
transform property.
Version: | CSS Transforms Module Level 1 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
Function | |||||
---|---|---|---|---|---|
scaleX() | 1 | 12 | 3.5 | 3.1 | 10.5 |
CSS Syntax
scaleX(s)
Value | Description |
---|---|
s | Required. A number that specifies the scaling vector for the width |
More Examples
Example
Use scaleX() to scale the width of images:
#img1 {
transform: scaleX(0.6);
}
#img2 {
transform: scaleX(90%);
}
#img3 {
transform: scaleX(-0.6);
}
#img4 {
transform: scaleX(1.1);
}
Try it Yourself »
Related Pages
CSS reference: CSS transform property.
CSS reference: CSS scale property.
CSS reference: CSS scale() function.
CSS reference: CSS scale3d() function.
CSS reference: CSS scaleY() function.
CSS tutorial: CSS 2D transforms.