grid-alignment-style-changes-004.html (2284B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Grid Layout Test: Changing the Self-Alignment properties to interfere in Baseline Alignment</title> 4 <link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align"> 6 <link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment"> 7 <link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-self-property"> 8 <link rel="help" href="https://drafts.csswg.org/css-align/#typedef-baseline-position"> 9 <meta name="assert" content="Changing the 'justify-self' property's value of a grid item to 'baseline' will include such item into a baseline context, which implies recomputing all the baseline offsets and aligning the items in such context."> 10 <style> 11 #container { 12 position: relative; 13 display: inline-grid; 14 grid: 50px 50px 50px / 100px; 15 background: grey; 16 justify-items: baseline; 17 } 18 #container > div { writing-mode: vertical-rl; } 19 #item1 { 20 width: 20px; 21 background: blue; 22 } 23 #item2 { 24 width: 50px; 25 margin: 0 10px; 26 background: green; 27 justify-self: center; 28 } 29 #item3 { 30 width: 30px; 31 background: red; 32 } 33 </style> 34 <script src="/resources/testharness.js"></script> 35 <script src="/resources/testharnessreport.js"></script> 36 <script src="/resources/check-layout-th.js"></script> 37 <script src="support/style-change.js"></script> 38 <script> 39 function runTest() { 40 let before = { 41 item1: {"data-offset-x": 70 }, 42 item2: {"data-offset-x": 25 }, 43 item3: {"data-offset-x": 70 } 44 }; 45 46 let after = { 47 item1: {"data-offset-x": 40 }, 48 item2: {"data-offset-x": 40 }, 49 item3: {"data-offset-x": 40 } 50 }; 51 52 evaluateStyleChangeMultiple("before", before); 53 item2.style.justifySelf = "baseline"; 54 evaluateStyleChangeMultiple("after", after); 55 done(); 56 } 57 </script> 58 <body onload="runTest()"> 59 <div id="container"> 60 <div id="item1" data-expected-width="20" data-expected-height="50" data-offset-y="0"></div> 61 <div id="item2" data-expected-width="50" data-expected-height="50" data-offset-y="50"></div> 62 <div id="item3" data-expected-width="30" data-expected-height="50" data-offset-y="100"></div> 63 </div> 64 <div id="log"></div> 65 </body>