Home  >  Article  >  Web Front-end  >  Summary of the zoom attribute in CSS

Summary of the zoom attribute in CSS

巴扎黑
巴扎黑Original
2017-06-02 17:41:163026browse

In CSS, the zoom attribute is used to set or retrieve the zoom ratio of the object. The corresponding script feature is zoom. Although many people know it, there are still some people who don’t know the specific usage of zoom, or have not studied it in depth. Let’s summarize the usage of zoom:

1. The attribute zoom in CSS style: 1 Detailed explanation of the role

The role of zoom:1 in CSS
Compatible with IE6, IE7, and IE8 browsers. We often encounter some problems, which can be solved by using zoom:1. It has the following functions:
Trigger haslayout of IE browser
Solve some problems such as floating and margin overlap under IE.

Summary of the zoom attribute in CSS

2.The zoom attribute or overflow:auto attribute in CSS clears floats

In fact, the Zoom attribute in CSS is generally not It is so well known that it cannot even be found in some CSS manuals. In fact, the Zoom attribute is a proprietary attribute of the IE browser and is not supported by Firefox and other browsers. It sets or retrieves the object's scaling. In addition, it has other functions, such as triggering IE's hasLayout attribute, clearing floats, clearing margin overlap, etc.

Summary of the zoom attribute in CSS

3.The difference between zoom and transform:scale()

Both zoom and transform:scale() can be used for zooming , there are currently a variety of mobile phones with different screen sizes on the mobile side. In order to be compatible with screens of different widths, we can create a page based on a certain screen width (such as 320 for iPhone5, this is based on the design draft), and then modify the page Scaled to accommodate other screen widths.

Summary of the zoom attribute in CSS

4.Using zoom in css

zoom: normal | number
normal: Default value. Use the actual size of the object
number : % | unsigned floating point real number. When the floating point real value is 1.0 or the percentage is 100%, it is equivalent to the normal value of this attribute. In vernacular explanation, it is zoom: the following number is the magnification multiple, which can be a numerical value or a percentage. For example: zoom:1, zoom:120%.

ps: It is said on the Internet that it is a proprietary attribute of IE. I personally tested it and it can also be used in chrome; (Firefox browser does not support it)

Questions and answers related to the zoom attribute:

1.How to calculate the control page size in css zoom?

2.zoom How can the background image be enlarged from the upper left corner of the page?

3.Using zoom:50% in CSS does not take effect on the page text size. Why?

The above is the detailed content of Summary of the zoom attribute in CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn