background-size-computed.html (1473B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Backgrounds and Borders: getComputedStyle().backgroundSize</title> 6 <link rel="help" href="https://drafts.csswg.org/css-backgrounds/#background-size"> 7 <meta name="assert" content="background-size computed value is a list, each item a pair of sizes (one per axis) each represented as either a keyword or a computed length-percentage value."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/computed-testcommon.js"></script> 11 <style> 12 #target { 13 font-size: 40px; 14 } 15 </style> 16 </head> 17 <body> 18 <div id="target"></div> 19 <script> 20 test_computed_value("background-size", "1px", "1px auto"); 21 test_computed_value("background-size", "1px auto", "1px auto"); 22 test_computed_value("background-size", "2% 3%"); 23 test_computed_value("background-size", "auto"); 24 test_computed_value("background-size", "auto auto", "auto"); 25 test_computed_value("background-size", "auto 4%"); 26 test_computed_value("background-size", "contain"); 27 test_computed_value("background-size", "cover"); 28 test_computed_value("background-size", "calc(10px + 0.5em) calc(10px - 0.5em)", "30px 0px"); 29 test_computed_value("background-size", "calc(10px - 0.5em) calc(10px + 0.5em)", "0px 30px"); 30 31 // See background-computed.html for a test with multiple background images. 32 test_computed_value("background-size", "auto 1px, 2% 3%, contain", "auto 1px"); 33 </script> 34 </body> 35 </html>