|
1 <style> |
|
2 body { overflow: scroll } |
|
3 div { |
|
4 width: 10px; |
|
5 height: 10px; |
|
6 background-color: #d64203; |
|
7 } |
|
8 </style> |
|
9 |
|
10 <body> |
|
11 <div id="a"></div> |
|
12 <div id="b"></div> |
|
13 <div id="c"></div> |
|
14 <div id="d"></div> |
|
15 |
|
16 <!-- |
|
17 Ensure that the scroller positioned the same way as it would be in the |
|
18 'overflow: auto' case. We'll have scrollbars either way, but we don't |
|
19 want the '!=' reftest to spuriously succeed because of the scrollers. |
|
20 --> |
|
21 <div style="width: 500px; height: 500px; background-color: black"> |
|
22 </body> |
|
23 |
|
24 <script> |
|
25 // client{Width, Height} consist of the area _inside_ the scrollbars, so these |
|
26 // manually calculated units reflect the fact that with 'overflow: scroll' set, |
|
27 // viewport units are sized taking the scrollbars into account. |
|
28 var vw = 0.01 * document.body.clientWidth; |
|
29 var vh = 0.01 * document.body.clientHeight; |
|
30 var vmin = Math.min(vw, vh); |
|
31 var vmax = Math.max(vw, vh); |
|
32 document.getElementById('a').style.width = (50 * vw) + "px"; |
|
33 document.getElementById('b').style.height = (25 * vh) + "px"; |
|
34 document.getElementById('c').style.width = (35 * vmin) + "px"; |
|
35 document.getElementById('d').style.height = (25 * vmax) + "px"; |
|
36 </script> |