首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:CSS 教程
TRY RUN / 在线示例
CSS 教程 使用 :focus
CSS 教程 使用 :focus
源代码
运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>安科教程(www.ancii.com)</title> <style> input:focus { background-color:yellow; } </style> </head> <body> <form action="demo-form" method="get"> First name: <input type="text" name="fname" /><br> Last name: <input type="text" name="lname" /><br> <input type="submit" value="Submit" /> </form> <p><b>注意:</b>仅当 !DOCTYPE已经声明时 IE8支持 :focus.</p> </body> </html>
运行结果