relative-units-003.html (995B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Test: Font-relative length units (ex) in width media queries</title> 6 <link rel="author" title="Chris Rebert" href="http://chrisrebert.com"> 7 <link rel="help" href="https://www.w3.org/TR/css3-mediaqueries/#units"> 8 <link rel="help" href="https://www.w3.org/TR/mediaqueries-4/#units"> 9 <link rel="match" href="reference/ref-green-body.xht"> 10 <meta name="assert" content="Font-relative length units (such as 'ex') in media queries should be calculated based on the initial value of 'font-size', not based on author style declarations, such as: html { font-size: 200%; }"> 11 <style> 12 :root { 13 font-size: 100000px;/* ~87ft */ 14 } 15 body { 16 background: red; 17 } 18 p { 19 font-size: 24px; 20 } 21 </style> 22 </head> 23 <body> 24 <p>This should have a green background.</p> 25 <script> 26 document.body.offsetTop; 27 </script> 28 <style> 29 @media (min-width: 1ex) { 30 body { 31 background: green; 32 } 33 } 34 </style> 35 </body> 36 </html>