focus-pseudo-class-001.xht (1597B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Test: :focus pseudo-class - adjacent sibling selector</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" href="http://www.w3.org/TR/html4/interact/forms.html#h-17.11" /> 11 <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes" /> 12 <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#adjacent-selectors" /> 13 <meta name="flags" content="interact" /> 14 <meta name="assert" content="An HTML 4 textarea must be focused in order to enter text into it. The :focus pseudo-class applies to a textarea while it has the focus (accepts keyboard events or other forms of text input)." /> 15 16 <style type="text/css"><![CDATA[ 17 span 18 { 19 color: white; 20 font-size: 150%; 21 } 22 23 textarea:focus + span 24 { 25 color: green; 26 } 27 ]]></style> 28 29 </head> 30 31 <body> 32 33 <p>Enter in the text field below with the pointing device or with the keyboard (with the tab key or with the "T" accesskey) and then enter some text into it. A message in green should then have appeared on its right-hand side indicating that such text field has received focus. In order to pass this test, the tester should not have to move the pointing device outside the text field.</p> 34 35 <div> 36 <textarea cols="32" rows="4" accesskey="T" tabindex="1"></textarea> <span>Focus received by text field</span> 37 </div> 38 39 </body> 40 </html>