replaced-element-033.html (1359B)
1 <!DOCTYPE html> 2 <title>CSS aspect-ratio: img block size with box-sizing (vertical writing mode)</title> 3 <link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> 4 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht" /> 5 <style> 6 img { 7 writing-mode: vertical-rl; 8 border-top: 40px solid green; 9 } 10 </style> 11 12 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 13 14 <!-- 15 1st: A green rect 60x100. 16 border-top is 60x40 and the content box is 60x60. 17 We use 'aspect-ratio: auto && <ratio>', so the aspect-ratio works with 18 content-box dimensions always. The inline size of the content box is 19 (100px - 40px) = 60px, so the block size is 60px * 1/1 = 60px. 20 21 2nd: A green rect 20x100. 22 border-top is 20x40 and the content box is 20x60. 23 24 3rd: A green rect 20x100. 25 border-top is 20x40 and the content box is 20x60 because we compute 26 the block size by aspect-ratio which works with border-box and so the 27 block size is 100px / 5 = 20px. 28 --> 29 <img src="support/1x1-green.png" style="height: 100px; aspect-ratio: auto 1/10; box-sizing: border-box;" 30 ><img src="support/1x1-green.png" style="height: 60px; aspect-ratio: 1/3; box-sizing: content-box;" 31 ><img src="support/1x1-green.png" style="height: 100px; aspect-ratio: 1/5; box-sizing: border-box;">