如何在 IE 中隐藏 CSS 活动图像
我有一个输入框,它是我的登录功能的一部分。我正在 css 中显示图像,然后单击框 (:active),图像消失,允许用户输入信息。我使用图像的原因是因为文本密码显示*。
这在除 IE 之外的所有浏览器中都可以正常工作。任何人都可以帮忙。
HTML:
<form class="additemsignupformlivregister">
<div class="logininputdiv">
<input type="text" class="filterinput clearField">
</div>
<div class="logininputdiv">
<input type="password" class="filterinputpassword clearField">
</div>
</form>
这是 CSS:
.filterinput {
-moz-border-radius:3px;
border-radius:3px;
-webkit-border-radius:3px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 2px #9B9B9C inset;
color: #9b9b9c;
font-family: arial;
font-size: 12px;
height: 30px;
line-height: 30px;
margin-bottom: 10px;
margin-left: -3px;
padding-left: 5px;
padding-right: 10px;
width: 170px;
background-image: url("../images/enteremail.png");
background-repeat: no-repeat;
}
同样,单击输入字段,图像会在 Firefox、Chrome 和 Safari 中消失,但不会在 IE 中消失。谢谢。
.filterinput:focus{
box-shadow:0 0 2px #000000 inset;
-moz-box-shadow:0 0 2px #000000 inset;
-webkit-box-shadow:0 0 2px #000000 inset;
color: #000000;
background: none;
}
I have an input box that is part of my log in functionality. I am displaying an image in css and onclick on the box (:active), the image disappears allowing the user to type in the information. The reason I am using an image is because of the text password displaying *.
This works fine in all browsers except IE. Can anyone help.
HTML:
<form class="additemsignupformlivregister">
<div class="logininputdiv">
<input type="text" class="filterinput clearField">
</div>
<div class="logininputdiv">
<input type="password" class="filterinputpassword clearField">
</div>
</form>
Here is the CSS:
.filterinput {
-moz-border-radius:3px;
border-radius:3px;
-webkit-border-radius:3px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 2px #9B9B9C inset;
color: #9b9b9c;
font-family: arial;
font-size: 12px;
height: 30px;
line-height: 30px;
margin-bottom: 10px;
margin-left: -3px;
padding-left: 5px;
padding-right: 10px;
width: 170px;
background-image: url("../images/enteremail.png");
background-repeat: no-repeat;
}
Again, onclick on the input field the image disappears in Firefox, Chrome, and Safari but not IE. Thanks.
.filterinput:focus{
box-shadow:0 0 2px #000000 inset;
-moz-box-shadow:0 0 2px #000000 inset;
-webkit-box-shadow:0 0 2px #000000 inset;
color: #000000;
background: none;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IE 5.5、6 和 7 不支持
:focus
css 选择器http://reference.sitepoint.com/css/pseudoclass-focus
将 id 添加到您的密码输入中
将其添加到您的
head
标记中并将其添加到您的 CSS 中:
使用 jQuery 你只需要这样做:
仅将其包装起来,以便其他正常工作的浏览器不会有此开销。
您仍然需要定义 css
.filterinput.focus
类。IE 5.5, 6, and 7 do not support the
:focus
css selectorhttp://reference.sitepoint.com/css/pseudoclass-focus
Add an id to your password input
Add this in your
head
tagAnd this to your CSS:
Using jQuery you would only need to do this:
Only wrapped that so that other browsers that work properly don't have this overhead.
You will still need the css
.filterinput.focus
class defined.