selection-textarea-011.html (1088B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Pseudo-Elements Test: active selection and textarea element</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-pseudo-4/#highlight-selectors"> 9 <link rel="match" href="reference/selection-textarea-011-ref.html"> 10 11 12 <style> 13 textarea 14 { 15 background-color: red; 16 color: yellow; 17 font-family: monospace; 18 font-size: 48px; 19 height: 112px; 20 line-height: 56px; 21 padding: 0px; 22 resize: none; 23 width: 8ch; 24 outline: none; 25 } 26 27 textarea::selection 28 { 29 background-color: yellow; 30 color: green; 31 } 32 </style> 33 34 <script> 35 function startTest() 36 { 37 document.getElementById("test").select(); 38 } 39 </script> 40 41 <body onload="startTest();"> 42 43 <p>Test passes if each glyph of both "Selected" is green with a yellow background and if there is <strong>no red</strong>. 44 45 <div><textarea id="test" rows="2" cols="8">Selected Selected </textarea></div>