text-align-match-parent-04

CSS Text: text-align: match-parent

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Flags
dom
Assertion
Text checks that an element with text-align: match-parent still aligns correctly if the parent's width is changed

Source

 1 <!DOCTYPE html>
 2 <html class="reftest-wait"><head>
 3     <meta charset="utf-8">
 4     <title>CSS Text: text-align: match-parent</title>
 5     <link href="mailto:smontagu@mozilla.com" rel="author" title="Simon Montagu">
 6     <link href="http://www.w3.org/TR/css-text-3/#text-align-property" rel="help">
 7     <meta content="dom" name="flags">
 8     <meta content="Text checks that an element with
 9       text-align: match-parent still aligns correctly if the parent's
10       width is changed" name="assert">
11      <link href="reference/text-align-match-parent-ref.htm" rel="match">
12     <style type="text/css">
13 div.start  { text-align: start; }
14 div.end    { text-align: end; }
15 div.left   { text-align: left; }
16 div.right  { text-align: right; }
17 div > div  { text-align: match-parent; }
18     </style>
19     <script type="text/javascript">
20 function changeParentWidth()
21 {
22   for (parent = 0; parent < 16; ++parent) {
23      var parentDiv = document.getElementById("d" + parent);
24      parentDiv.style.width = "";
25    }
26 
27   document.documentElement.removeAttribute("class");
28 }
29    </script>
30   </head>
31   <body onload="changeParentWidth()">
32    <div>Test passes if each line that says "Left" is aligned left and
33    each line that says "Right" is aligned right</div>
34    <div style="width: 50%;" class="start" dir="ltr" id="d0"><div dir="ltr">Left</div></div>
35    <div style="width: 50%;" class="start" dir="ltr" id="d1"><div dir="rtl">Left</div></div>
36    <div style="width: 50%;" class="start" dir="rtl" id="d2"><div dir="ltr">Right</div></div>
37    <div style="width: 50%;" class="start" dir="rtl" id="d3"><div dir="rtl">Right</div></div>
38    <div style="width: 50%;" class="end" dir="ltr" id="d4"><div dir="ltr">Right</div></div>
39    <div style="width: 50%;" class="end" dir="ltr" id="d5"><div dir="rtl">Right</div></div>
40    <div style="width: 50%;" class="end" dir="rtl" id="d6"><div dir="ltr">Left</div></div>
41    <div style="width: 50%;" class="end" dir="rtl" id="d7"><div dir="rtl">Left</div></div>
42    <div style="width: 50%;" class="left" dir="ltr" id="d8"><div dir="ltr">Left</div></div>
43    <div style="width: 50%;" class="left" dir="ltr" id="d9"><div dir="rtl">Left</div></div>
44    <div style="width: 50%;" class="left" dir="rtl" id="d10"><div dir="ltr">Left</div></div>
45    <div style="width: 50%;" class="left" dir="rtl" id="d11"><div dir="rtl">Left</div></div>
46    <div style="width: 50%;" class="right" dir="ltr" id="d12"><div dir="ltr">Right</div></div>
47    <div style="width: 50%;" class="right" dir="ltr" id="d13"><div dir="rtl">Right</div></div>
48    <div style="width: 50%;" class="right" dir="rtl" id="d14"><div dir="ltr">Right</div></div>
49    <div style="width: 50%;" class="right" dir="rtl" id="d15"><div dir="rtl">Right</div></div>
50  
51 
52 </body></html>