I found that some jQuery Plugin, in their css rule uses ‘zoom’ descriptor, I even Look into w3c website and found that it is used to magnify but how can I actually implement it? Or I have to Define some viewport? And how do I define such viewport ? Or i am wrong about the whole stuff ?
is it possible to use it like
Css Solutions
Solution 1 — Css
Zoom is not included in the CSS specification, but it is supported in IE, Safari 4, Chrome (and you can get a somewhat similar effect in Firefox with -moz-transform: scale(x) since 3.5). See here.
will zoom your object in by 2, so it’s like doubling the size. Which means if you have
Like I say, in FireFox 3.5+ use -moz-transform: scale(x) , it does much the same thing.
Edit: In response to the comment from thirtydot , I will say that scale() is not a complete replacement. It does not expand in line like zoom does, rather it will expand out of the box and over content, not forcing other content out of the way. See this in action here. Furthermore, it seems that zoom is not supported in Opera.
This property controls the magnification level for the current element. The rendering effect for the element is that of a “zoom” function on a camera. Even though this property is not inherited, it still affects the rendering of child elements.
div < zoom: 200% > div style=”zoom: 200%”>This is x2 text
Solution 5 — Css
zoom is a css3 spec for the @viewport descriptor, as described here
used to zoom the entire viewport (‘screen’). it also happens to zoom individuals elements in a lot of browsers, but not all. css3 specifies transform:scale should be used to achieve such an effect:
but it works a little different than the ‘element zoom’ in those browsers that support it.
Solution 6 — Css
Only IE and WebKit support zoom, and yes, in theory it does exactly what you’re saying.
Try it out on an image to see it’s full effect 🙂
Solution 7 — Css
As Joshua M pointed out, the zoom function isn’t supported only in Firefox, but you can simply fix this as shown:
Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The non-standard zoom CSS property can be used to control the magnification level of an element. transform: scale() should be used instead of this property, if possible. However, unlike CSS Transforms, zoom affects the layout size of the element.
Do not (de)magnify this element if the user applies non-pinch-based zooming (e.g. by pressing Ctrl — — or Ctrl + + keyboard shortcuts) to the document. Do not use this value, use the standard unset value instead.
Zoom factor. 100% is equivalent to normal . Values larger than 100% zoom in. Values smaller than 100% zoom out.
Zoom factor. Equivalent to the corresponding percentage ( 1.0 = 100% = normal ). Values larger than 1.0 zoom in. Values smaller than 1.0 zoom out.
Свойство zoom изменяет масштаб элемента. Если меньше 1 или 100%, то элемент уменьшится. А если больше 1 или 100%, то элемент увеличится.
На данный момент не поддерживается в FireFox. Проверяйте поддержку на Can I use.
Пример
Скопировать ссылку «Пример» Скопировано
При наведении текст уменьшается на 50% Сохраняется исходный размер текста При наведении текст увеличивается в 2 разаpclass="small-text">При наведении текст уменьшается на 50%p>pclass="normal-text">Сохраняется исходный размер текстаp>pclass="big-text">При наведении текст увеличивается в 2 разаp>
normal — задаёт элементу исходный масштаб. Значение по умолчанию.
число — коэффициент масштабирования. 1.0 эквивалентно значению normal .
процент — процентное значение. 100% эквивалентно значению normal .
reset — не изменяет масштаб элемента, если пользователь применяет к документу масштабирование без сведения (разведения) пальцев, т. е. масштабирование, применимое к сенсорным интерфейсам. Это нестандартное значение, перед его использованием следует проверить поддержку на Can I use.
Zoom is not included in the CSS specification, but it is supported in IE, Safari 4, Chrome (and you can get a somewhat similar effect in Firefox with -moz-transform: scale(x) since 3.5). See here.
will zoom your object in by 2, so it’s like doubling the size. Which means if you have
Like I say, in FireFox 3.5+ use -moz-transform: scale(x) , it does much the same thing.
Edit: In response to the comment from thirtydot , I will say that scale() is not a complete replacement. It does not expand in line like zoom does, rather it will expand out of the box and over content, not forcing other content out of the way. See this in action here. Furthermore, it seems that zoom is not supported in Opera.
This post gives a useful insight into ways to work around incompatibilities with scale and workarounds for it using jQuery.
What exactly changes in the css rendering, when desktop browsers zoom in or out on a website?
Zooming as implemented in modern browsers consists of nothing more than “stretching up” pixels. That is, the width of the element is not changed from 128 to 256 pixels; instead the actual pixels are doubled in size. Formally, the element still has a width of 128 CSS pixels, even though it happens to take the space of 256 device pixels.
In other words, zooming to 200% makes one CSS pixel grow to four times the size of one device pixels. (Two times the width, two times the height, yields four times in total).
Source: Concept of device pixels and CSS pixels
What does *zoom:1 do in bootstrap?
It’s like an inline conditional statement for IE5.5 — IE7. Only IE 5.5, IE6, and IE7 will display zoom: 1 because of the inline * (known as the «star property hack»). Similar to the IE6 hack with the underscore _ .
Zoom Vs. Scale in CSS3
Transform is more predictable than zoom across browsers.
Zoom affects positioning differently in different browsers.
example: position:absolute; left:50px; zoom: 50%;
IE will not change the left value at all.
Chrome will change the left value to 25px . Effectively it does do left = left * zoom . But DevTools Computed Values in DevTools will still display left: 50px , even though that is effectively not true due to the zoom.
Transform is handled the same way in all browsers (as far as I can tell).
You may also need transform-origin (and browser-specific versions) to make it behave the same way as zoom , and you’ll have to be careful to target zoom only at IE, because WebKit supports both transform and zoom so would double-scale.
Reduce the size of all elements in html like zooming out the page
All HTML content inside of the body tag can be «zoomed» in and out by using the CSS zoom attribute.
For example, to zoom content to 90% simply modify the body element to
zoom css/javascript
The Firefox & Chrome (Webkit) equivalents to the IE-specific zoom property are, respectively, -moz-transform and -webkit-transform .
CSS: How to zoom in the background-image only slightly
My suggestion would be to attempt using the ‘transform’ CSS attribute. You can then give a value of ‘scale()’ with a number passed into the parentheses. The higher the number, the more the zoomed the image will appear. The good news is that you can use decimals too. This will allow you to zoom the image just a bit at a time. This would look a bit something like this.
The zoom property is used to scale the content. For scaling the content, you can also use the transform property set to «scale()».
This feature is non-standard and it is not recommended to use it for production sites, because it is not supported by Firefox. Therefore, you can use transform: scale to change a site element’s size.
Initial Value
normal
Applies to
All elements.
Inherited
No.
Animatable
Yes.
Version
Safari CSS Reference.
DOM Syntax
object.style.zoom = «4»;
Syntax
zoom: normal | number | percentage | reset | initial | inherit;