开发者

Focus CSS tag in Internet Explorer 8

开发者 https://www.devze.com 2023-01-03 18:30 出处:网络
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 locall

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"开发者_StackOverflow社区 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.


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/


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消