Categories
CSS

How to scale the contents of a div by a percentage with CSS?

Spread the love

Sometimes, we want to scale the contents of a div by a percentage with CSS.

In this article, we’ll look at how to scale the contents of a div by a percentage with CSS.

How to scale the contents of a div by a percentage with CSS?

To scale the contents of a div by a percentage with CSS, we can set the zoom and -moz-transform CSS properties.

For instance, we write

#myContainer {
  zoom: 0.5;
  -moz-transform: scale(0.5);
}

to scale the contents of the element with ID myContainer by a factor of 0.5 by setting zoom to 0.5 and -moz-transform to scale(0.5).

Conclusion

To scale the contents of a div by a percentage with CSS, we can set the zoom and -moz-transform CSS properties.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *