Menu Close

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

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.

Posted in CSS