Definition and function of zoom: 1 attribute in CSS

Time:2019-12-10

Today, I was asked what is the use of a zoom property in CSS, although I know that this property is used to clear floats and trigger hasLayout. But the specific definition is not very well understood. Baidu has a little information about the property of zoom, and then summarizes it.

CSS zoom properties

Zoom: set or retrieve the scale of the object, trigger the hasLayout attribute of IE browser, solve some problems such as floating, margin overlapping, etc.

Syntax:

zoom:normal

Parameters:

Normal: use the actual size of the object (default)
Number: use numbers to define the scale. Negative numbers are not allowed,

Example:

zoom:5

Percentage: use percentage to define the scale, no negative number is allowed

Example:

zoom:200%

Zoom is a special attribute of IE browser. In the past, Firefox, Google and other browsers were not supported and did not pass the W3C standard. However, now this attribute is standardized and has appeared in the draft of CSS3.

In addition:

The zoom attribute in CSS can be used to make the web page realize the zoom function in IE7.

For example, if you want to reduce your web page to half of its original size, then add it to the bodystyle="zoom:0.5",Such as:

Program code
 

<body style="zoom:0.5">

summary

The above is the definition and function of zoom: 1 attribute in CSS introduced by Xiaobian to you. I hope it can help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support of the developepaer website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!