Computer >> Computer tutorials >  >> Programming >> CSS

Change the width of element using CSS


Use the scaleX() method to change the width of an element with CSS.

Let us see the syntax −

scaleX(n);

Here, n is a number representing the scaling factor.

Let us see an example

div {
   width: 40px;
   height: 50px;
   background-color: black;
}
.myScaled {
   transform: scaleX(0.9);
   background-color: orange;
}