Focus CSS tag in Internet Explorer 8

醉酒当歌 提交于 2020-01-05 08:35:11

问题


This is driving me nuts.

http://www.cssdrive.com/index.php/examples/exampleitem/focus_pseudo_class

This is an example of using the hover pseudo-class. Works fine in Chrome and IE. When I save locally it works fine in Chrome but won't work in IE. What am I doing wrong!?

<link rel="Stylesheet" href="style.css" />
<form>
    <p>1) Name:<br />
    <input type="text" size="40"></p>

    <p>2) Email address:<br />
    <input type="text" size="40"></p>

    <p>3) Comments:<br />
    <textarea rows="5" name="comments" cols="45" wrap="virtual"></textarea></p>

    <p><input id="actualsubmit" type="submit" value="Submit"></p>
</form>

style.css:

input:focus, textarea:focus{
    background-color: lightyellow;
}   

EDIT: The style sheet is applying - can be tested by background-color: black. But the focus effect is not working.


回答1:


I believe that IE8 still doesn't support it properly, here's a JS workaround: http://james.padolsey.com/javascript/fixing-focus-in-internet-explorer/




回答2:


It appears as though IE8 fails when the style is <link>'d rather than <style>'d on the page.




回答3:


Try "stylesheet" instead of "Stylesheet" in your link tag? Might be case-sensitive.



来源:https://stackoverflow.com/questions/3069435/focus-css-tag-in-internet-explorer-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!