`
zlpx
  • 浏览: 153170 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

在HTML的text input控件获取焦点时设置背景颜色

 
阅读更多

下面的例子展示了在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

 

分享到:
评论
1 楼 f308185993 2015-09-25  
123123[size=xx-small][color=darkr[color=red]
[flash=200,200][img][url][list]
[*]
引用
[u][i][b][/b][/i][/u]
[/list][/url][/img][/flash]
[/color]ed][/color][/size]

相关推荐

Global site tag (gtag.js) - Google Analytics