【发布时间】:2010-12-17 16:06:50
【问题描述】:
我有一些标记,我正在尝试在 accosicated 文本输入具有焦点时点亮“某些输入的提示”。我正在尝试将焦点伪类与兄弟选择器一起使用。如果我只使用其中一种,它就可以了。但是,当在 IE8 中组合它们时,当您通过文本框进行选项卡时,似乎该样式没有得到更新。注意:如果您在文本框之外单击并返回,它们的样式会更新。
这里是标记:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
html { font-family: Arial; }
.lineItem {padding:5px; clear:both; }
.label { display:block; font-size:large; color: #2C2F36; font-weight:bold; padding:5px 0px 3px 0px; }
.textbox:focus { background-color: #FFFFBF; }
.textbox { font-size: large; color: #2C2F36; width:300px; background-color: #FFFFE8; padding:3px 5px; border:solid 2px #cecece; float:left; }
.hint { margin-left:10px; width:175px; font-size:smaller; display:block; float:left; color: #466E62; }
.textbox:focus+.hint {color: Red; }
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="lineItem">
<label for="ListName" class="label">List Name</label>
<input id="Name" name="ListName" type="text" class="textbox" />
<span class="hint" id="NameHint">This is the title of your List.</span>
</div>
<div class="lineItem">
<label for="ListSlug" class="label">http://List/Username/</label>
<input id="Slug" name="ListSlug" type="text" class="textbox" />
<span class="hint" id="SlugHint">The URL that you will use to share your list with others.</span>
</div>
</div>
</form>
</body>
</html>
这是我看到的截图:
Screenshot http://www.osbornm.com/pics/IE8Issue.png
注意:适用于其他浏览器:(以及其他伪类,例如悬停工作
【问题讨论】:
标签: css internet-explorer-8 cross-browser css-selectors