background-image-computed.sub.html (6897B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Backgrounds and Borders: getComputedStyle().backgroundImage</title> 6 <link rel="help" href="https://drafts.csswg.org/css-backgrounds/#background-image"> 7 <meta name="assert" content="background-image computed value is as specified."> 8 <meta name="assert" content="Colors and lengths are computed, with radii clamped."> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <script src="/css/support/computed-testcommon.js"></script> 12 <style> 13 #target { 14 font-size: 40px; 15 } 16 </style> 17 </head> 18 <body> 19 <!-- target is used by test_computed_value --> 20 <div id="target"></div> 21 <script> 22 test_computed_value("background-image", "none"); 23 24 test_computed_value("background-image", 'url("http://{{host}}/")'); 25 test_computed_value("background-image", 'none, url("http://{{host}}/")'); 26 27 test_computed_value('background-image', 'linear-gradient(to left bottom, red, blue)', 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255))'); 28 29 test_computed_value('background-image', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 30 test_computed_value('background-image', 'radial-gradient(at center, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 31 test_computed_value('background-image', 'radial-gradient(at 50%, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 32 test_computed_value('background-image', 'radial-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 33 test_computed_value('background-image', 'radial-gradient(farthest-side, rgb(255, 0, 0), rgb(0, 0, 255))'); 34 test_computed_value('background-image', 'radial-gradient(farthest-side at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 35 test_computed_value('background-image', 'radial-gradient(farthest-corner, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 36 test_computed_value('background-image', 'radial-gradient(farthest-corner at center, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 37 test_computed_value('background-image', 'radial-gradient(farthest-corner at 50%, red, blue)', 'radial-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 38 test_computed_value('background-image', 'radial-gradient(farthest-corner at 10px 10px, red, blue)', 'radial-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 39 40 test_computed_value('background-image', 'radial-gradient(10px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))'); 41 test_computed_value('background-image', 'radial-gradient(circle calc(-0.5em + 10px) at calc(-1em + 10px) calc(-2em + 10px), red, blue)', 'radial-gradient(0px at -30px -70px, rgb(255, 0, 0), rgb(0, 0, 255))'); 42 test_computed_value('background-image', 'radial-gradient(ellipse calc(-0.5em + 10px) calc(0.5em + 10px) at 20px 30px, red, blue)', 'radial-gradient(0px 30px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))'); 43 test_computed_value('background-image', 'radial-gradient(ellipse calc(0.5em + 10px) calc(-0.5em + 10px) at 20px 30px, red, blue)', 'radial-gradient(30px 0px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))'); 44 45 test_computed_value('background-image', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 46 test_computed_value('background-image', 'conic-gradient(red, gold)', 'conic-gradient(rgb(255, 0, 0), rgb(255, 215, 0))'); 47 test_computed_value('background-image', 'conic-gradient(red 0%, gold 100%)', 'conic-gradient(rgb(255, 0, 0) 0%, rgb(255, 215, 0) 100%)') 48 test_computed_value('background-image', 'conic-gradient(red 0deg, gold 1turn)', 'conic-gradient(rgb(255, 0, 0) 0deg, rgb(255, 215, 0) 360deg)'); 49 test_computed_value('background-image', 'conic-gradient(white -50%, black 150%)', 'conic-gradient(rgb(255, 255, 255) -50%, rgb(0, 0, 0) 150%)'); 50 test_computed_value('background-image', 'conic-gradient(white -180deg, black 540deg)', 'conic-gradient(rgb(255, 255, 255) -180deg, rgb(0, 0, 0) 540deg)'); 51 test_computed_value('background-image', 'conic-gradient(hsl(0,0%,75%), hsl(0,0%,25%))', 'conic-gradient(rgb(191, 191, 191), rgb(64, 64, 64))'); 52 test_computed_value('background-image', 'conic-gradient(at center, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 53 test_computed_value('background-image', 'conic-gradient(at 50%, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 54 test_computed_value('background-image', 'conic-gradient(at 25% 75%, red, gold)', 'conic-gradient(at 25% 75%, rgb(255, 0, 0), rgb(255, 215, 0))'); 55 test_computed_value('background-image', 'conic-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 56 test_computed_value('background-image', 'conic-gradient(from 0deg, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 57 test_computed_value('background-image', 'conic-gradient(from 0deg at center, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 58 test_computed_value('background-image', 'conic-gradient(from 0deg at 50%, red, blue)', 'conic-gradient(rgb(255, 0, 0), rgb(0, 0, 255))'); 59 test_computed_value('background-image', 'conic-gradient(from 0deg at 50% 50%, red, gold)', 'conic-gradient(rgb(255, 0, 0), rgb(255, 215, 0))'); 60 test_computed_value('background-image', 'conic-gradient(from 0deg at 10px 10px, red, blue)', 'conic-gradient(at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 61 test_computed_value('background-image', 'conic-gradient(from 45deg, rgb(255, 0, 0), rgb(0, 0, 255))'); 62 test_computed_value('background-image', 'conic-gradient(from 45deg, white, black, white)', 'conic-gradient(from 45deg, rgb(255, 255, 255), rgb(0, 0, 0), rgb(255, 255, 255))'); 63 test_computed_value('background-image', 'conic-gradient(from 45deg at center, red, blue)', 'conic-gradient(from 45deg, rgb(255, 0, 0), rgb(0, 0, 255))'); 64 test_computed_value('background-image', 'conic-gradient(from 45deg at 50%, red, blue)', 'conic-gradient(from 45deg, rgb(255, 0, 0), rgb(0, 0, 255))'); 65 test_computed_value('background-image', 'conic-gradient(from 45deg at 10px 10px, red, blue)', 'conic-gradient(from 45deg at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 66 test_computed_value('background-image', 'conic-gradient(from -45deg, rgb(255, 0, 0), rgb(0, 0, 255))'); 67 test_computed_value('background-image', 'conic-gradient(from -45deg at center, red, blue)', 'conic-gradient(from -45deg, rgb(255, 0, 0), rgb(0, 0, 255))'); 68 test_computed_value('background-image', 'conic-gradient(from -45deg at 50%, red, blue)', 'conic-gradient(from -45deg, rgb(255, 0, 0), rgb(0, 0, 255))'); 69 test_computed_value('background-image', 'conic-gradient(from -45deg at 10px 10px, red, blue)', 'conic-gradient(from -45deg at 10px 10px, rgb(255, 0, 0), rgb(0, 0, 255))'); 70 71 test_computed_value('background-image', 'repeating-conic-gradient(red, gold)', 'repeating-conic-gradient(rgb(255, 0, 0), rgb(255, 215, 0))'); 72 test_computed_value('background-image', 'repeating-conic-gradient(from 0deg at center, red, gold)', 'repeating-conic-gradient(rgb(255, 0, 0), rgb(255, 215, 0))'); 73 </script> 74 </body> 75 </html>