我有一些標記,我試圖讓有些輸入的提示點亮,當焦慮的文本輸入有焦點時。我正在嘗試使用焦點僞類與兄弟選擇器一起使用。如果我只使用一個或另一個,它工作得很好。但是,將它們組合在IE8中時,它看起來好像在通過文本框標籤時該樣式不會更新。注意:如果您從文本框中單擊並退回,它們的樣式會更新。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
注:工作在其他瀏覽器: (和其他僞類,如懸停工作
+1爲您的詳細解釋和測試 – Seb 2009-11-20 15:19:42