white-space-applies-to-text-001.html (3479B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Text Test: white-space property applies to text</title> 6 7 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> 8 <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-processing"> 9 <link rel="help" href="https://www.w3.org/TR/css-display-3/#box-generation"> 10 <link rel="match" href="reference/white-space-applies-to-text-001-ref.html"> 11 12 <meta content="This test checks that 'white-space', which applies to inlines, also applies to text. In this test, we verify that 'white-space: normal', 'white-space: nowrap', 'white-space: pre', 'white-space: pre-wrap', 'white-space: break-spaces' and 'white-space: pre-line' apply to text." name="assert"> 13 14 <style> 15 section 16 { 17 border: black solid 2px; 18 float: left; 19 font-family: monospace; 20 font-size: 14px; 21 line-height: 1; /* computes to 14px */ 22 margin-bottom: 10px; 23 width: 16ch; 24 } 25 26 section.applies-to-text 27 { 28 clear: both; 29 } 30 31 section.applies-to-inline 32 { 33 margin-left: 10em; 34 } 35 36 div 37 { 38 display: contents; 39 } 40 41 div.first-subtest 42 { 43 white-space: normal; 44 } 45 46 div.second-subtest 47 { 48 white-space: nowrap; 49 } 50 51 div.third-subtest 52 { 53 white-space: pre; 54 } 55 56 div.fourth-subtest 57 { 58 white-space: pre-wrap; 59 } 60 61 div.fifth-subtest 62 { 63 white-space: break-spaces; 64 } 65 66 div.sixth-subtest 67 { 68 white-space: pre-line; 69 } 70 71 hr 72 { 73 clear: both; 74 margin: 4em auto 1.5em 0em; 75 width: 480px; 76 } 77 </style> 78 79 <p>Test passes if the characters inside of each black bordered rectangles on the lefthand side are laid out identically to their counterparts on the righthand side. 80 81 <section class="applies-to-text"> 82 <div class="first-subtest">Lorem ipsum. Dolor
 83 sit.</div> 84 </section> 85 86 <section class="applies-to-inline"> 87 <div class="first-subtest"><span>Lorem ipsum. Dolor
 88 sit.</span></div> 89 </section> 90 91 <hr> 92 93 <section class="applies-to-text"> 94 <div class="second-subtest">Lorem ipsum. Dolor
 95 sit.</div> 96 </section> 97 98 <section class="applies-to-inline"> 99 <div class="second-subtest"><span>Lorem ipsum. Dolor
 100 sit.</span></div> 101 </section> 102 103 <hr> 104 105 <section class="applies-to-text"> 106 <div class="third-subtest">Lorem ipsum. Dolor
 107 sit.</div> 108 </section> 109 110 <section class="applies-to-inline"> 111 <div class="third-subtest"><span>Lorem ipsum. Dolor
 112 sit.</span></div> 113 </section> 114 115 <hr> 116 117 <section class="applies-to-text"> 118 <div class="fourth-subtest">Lorem ipsum. Dolor
 119 sit.</div> 120 </section> 121 122 <section class="applies-to-inline"> 123 <div class="fourth-subtest"><span>Lorem ipsum. Dolor
 124 sit.</span></div> 125 </section> 126 127 <hr> 128 129 <section class="applies-to-text"> 130 <div class="fifth-subtest">Lorem ipsum. Dolor
 131 sit.</div> 132 </section> 133 134 <section class="applies-to-inline"> 135 <div class="fifth-subtest"><span>Lorem ipsum. Dolor
 136 sit.</span></div> 137 </section> 138 139 <hr> 140 141 <section class="applies-to-text"> 142 <div class="sixth-subtest">Lorem ipsum. Dolor
 143 sit.</div> 144 </section> 145 146 <section class="applies-to-inline"> 147 <div class="sixth-subtest"><span>Lorem ipsum. Dolor
 148 sit.</span></div> 149 </section>