×

CSS Zoom

CSS Zoom: Zoom property in CSS extents the content. This property controls the content’s level of magnification. Rather than the use of this CSS property, we may also apply the CSS property, i.e., transform: scale();.

The usage of the zoom property is not suggested because this property does not provide its support in a few browsers. The zoom CSS property is not a standard aspect, which is advised not to apply over production sites. Initially, it was implemented inside the IE browser.

Syntax:

zoom: normal | number | percentage | reset ;  

Zoom property in CSS provides its support for the values as above-mentioned, which are explained below.

normal: It displays the component to its size as normal. It specifies the general size of any component. It takes the general contents that do not zoom-in or zoom-out. It has value, i.e., zoom:1;

number: This property defines any positive value and illustrates any zoom factor. It contains values which are larger than value 1.0 depict zoom in (size increment), and smaller than value 1.0 depict zoom out (size reduction). Suppose we describe zoom: 1.5; after that, any content will 1.5 times greater than any original content.

percentage: It displays the values in percentage. In this, a 100% value is equal to its normal value. It extents any content with the use of any percentage value. It contains values that are larger than 100% depict zoom in (size increment), and smaller than 100% depict zoom out (size reduction). Suppose we describe zoom: 175%; after that, any content will 175% times greater than any original content.

Let’s understand this CSS property with the help of the following examples, which are discussed below.

Example1:

<!DOCTYPE html>
<html>
<head>
<title>
CSS Zoom
</title>
<style>
h1
{
 color: green;
}
h2
{
 color: lime;
}
magnify1
{
 zoom: 0.75;
}
magnify
{
 zoom: 1.5;
}
</style>
</head>
<body>
<center>
<h1> Zoom Property </h1>
<div>
<h2> Original Image </h2>
<img class= "original" src= "Flower1.jpg">
<h2> Magnified image zoom: 0.75; </h2>
<img class= "magnify1" src= "Flower1.jpg">
<h2> Magnified image zoom: 1.5; </h2>
<img class= "magnify" src= "Flower1.jpg">
</div>
</center>
</body>
</html>

Output:

CSS Zoom

Example2:

<!DOCTYPE html>
<html>
<head>
<title>
CSS Zoom
</title>
<style>
h1
{
 color: green;
}
.magnify
{
 width: 100px;
 height: 100px;
 border-radius: 30px;
 display: inline-block;
 color: white;
}
#m1
{
 background-color: yellow;
 zoom: normal;
 color: black;
}
#m2
{
 background-color: blue;
 zoom: 200%;
}
#m3
{
 background-color: lime;
 zoom: 2.9
}
p
{
 padding-top: 20px;
}
</style>
</head>
<body>
<center>
<h1> Zoom Property </h1>
<div id= "m1" class= "magnify"><p>zoom: normal;<p></div>
<div id= "m2" class= "magnify"><p>zoom: 200%;<p></div>
<div id= "m3" class= "magnify"><p>zoom: 2.9;<p></div>
</center>
</body>
</html>

Output:

CSS Zoom


Related Topics

CSS Margin

CSS Margin: The CSS margin property is employed to describe the space throughout the elements. It clears the range throughout the element. These properties do not have a background color...

2 minutes read.

CSS Text-align

Text-align The text-align property of CSS sets the table-cell box’s horizontal alignment or any block element. The text-align property is the same as the CSS property vertical-align but towards any horizontal...

1 minute read.

How to make smooth bounce animation using CSS

The smooth bouncing animation project is done with the help of HTML and CSS. This project gives so much fun and excitement to the users. What is HTML? The HTML or HyperText...

2 minutes read.

CSS Line Height

CSS Line Height: This property in CSS can be used to describe the line box’s minimal height inside the element. It sets-up the distinction among two lines in our content. It...

3 minutes read.

CSS Form

You can create attractive HTML form by using CSS. Style input Fields The Input Field width properties are used to determine the width of the input field. Let us see an example of CSS style...

2 minutes read.

What is CSS

CSS stands for Cascading Style Sheet. It gives an additional style to the HTML document. A cascading style sheet is a language that is designed to define the document formatting...

3 minutes read.

CSS Sticky

CSS Sticky The position property in CSS is applied to set an element’s position. This property is also applied to position an element behind the other element. It is useful for...

1 minute read.

CSS Font

CSS Font: CSS has font property, which makes the text more attractive. We can alter the entire look by changing font color, font size, font style, and much more. In...

5 minutes read.

CSS Color

CSS Colors: The CSS color property is used for setting the HTML element’s color. The color of the fonts and the color of the background can be set-up by using...

5 minutes read.

How to resize an image in CSS

How to resize an image in CSS? The resize image attribute is used in responsive web design to resize images to fit within the div container automatically. The resize image attribute...

3 minutes read.

CSS Word-spacing

Word-spacing The work-spacing property of CSS is applied to manage the space among the words. We can decrease or increase the space among the words by the use of this property. It...

3 minutes read.

CSS Border

CSS Border: The border property of CSS allows us to define the style, color, width, and radius of the element’s border. It is applied to various elements to set-up the...

4 minutes read.

Radial-gradient() CSS function

Radial-gradient() CSS function It defines a CSS in-built function, which produces a smooth transition among multiple colors. It is used to set any radial-gradient that is same as a background-image. This...

4 minutes read.

CSS Math Functions

The CSS math functions permit numerical articulations. These CSS math functions can particularly be utilized in maybe unforeseen ways, for example, inside angles and shading the functions and in the...

3 minutes read.

CSS Flex-Box

Introduction The flex-box property of CSS stands for Flexible Box Layout Module. It is specifically used to design a flexible responsive layout. Flex-box is a one dimensional layout model, i.e. it works...

6 minutes read.

CSS: nth-selector

CSS nth selector can be used to match an element according to its position regardless of its parent’s type. Here, n can be any number, formula, or a keyword. These selectors...

2 minutes read.

CSS Padding

CSS Padding: The padding property in CSS is addressed to describe the space among the element border and the element content.This property is quite different from the margin property of...

2 minutes read.

CSS Counters

CSS Counters: The CSS counter property is similar to the variables. CSS counters are controlled via CSS, and its values are incremented via rules of CSS to record how much...

4 minutes read.

CSS White Space Property

White Space in CSS The white-space CSS property describes how to show the content inside an element. This property is applied to manage a white space within an element. Values of White-space...

2 minutes read.

CSS Page-break-after Attribute

Page-break-after Attribute As its name implies, the page-break-before property is applied to include page break after any element, at the time of printing a document. It adds the page break after...

5 minutes read.