css-vars-custom-property-inheritance.html (1121B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Variables Test: custom properties use normal inheritance and cascade rules</title> 6 <link rel="author" title="Noah Collins" href="mailto:noahcollins@gmail.com"> 7 <link rel="help" href="http://www.w3.org/TR/css-variables-1/#using-variables"> 8 <meta name="assert" content="custom properties are resolved with the normal inheritance and cascade rules"> 9 <link rel="match" href="/css/reference/ref-filled-green-100px-square.xht"> 10 <style type="text/css"> 11 12 /* test cascade importance */ 13 :root { --color-1: green !important; } 14 :root { --color-1: red; } 15 div.color1 { background-color: var(--color-1); } 16 17 /* test cascade order */ 18 :root { --color-2: green; } 19 div.color2 { background-color: red; } 20 div.color2 { background-color: var(--color-2); } 21 22 div { width: 100px; height: 50px; } 23 </style> 24 </head> 25 <body> 26 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 27 <div class=color1></div> 28 <div class=color2></div> 29 </body> 30 </html>