Below is html code for testing. In other browser, all 3-divs are scale down by 0.5. However in IE(including IE9), absolutely positioned div(second-depth div) and it's child div(third-depth div) is not scale down properly.
How do I apply zoom style for all divs properly?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="zoom:0.5">
<div style="width:400px;height:400px;background:red">
<div style="position:absolute;width:200px;height:200px;background:black">
<div style="width:100px;height:100px;background:blue"></div>
</div>
</div>
</body>
</html>
Set the parent elements style to "position:relative". Now all elements inside the zoomed parent element should be zoomed as well.
zoom
is a non-standard IE property. Some other browsers (like firefox) will simply ignore itThe standards-compliant way of scaling an element is by using the
scale()
transform-function.Compare http://jsfiddle.net/tqMsv/ (zoom) with http://jsfiddle.net/tqMsv/1/ (scale)