日期:2014-05-17 浏览次数:20639 次
下面的例子展示了在HTML的text input控件获取焦点时设置背景颜色。通过设置background-color样式和:focuse 伪选择器(pseudo-selector).
?
?
<!DOCTYPE html> <html> <head> <title>Setting the background color on a focused HTML text input control</title> <style type="text/css"> input:focus { background-color: #FF6; } </style> </head> <body> <form> <label>First name: <input id="fname" type="text" autofocus placeholder="required" /></label><br/> <label>Last name: <input id="lname" type="text" placeholder="required" /></label><br/> <label>User name: <input id="uname" type="text" placeholder="required" /></label><br/> <label>Password: <input id="psswd" type="password" placeholder="required" /></label><br/> </form> </body> </html>
?源码下载:
?在HTML的text input控件获取焦点时设置背景颜色.zip
?