简体   繁体   English

IE8 CSS与IE7和Firefox不同

[英]IE8 CSS different from IE7 & Firefox

I'm applying a css style to a select dropdown and input textboxes. 我将CSS样式应用于选择下拉列表和输入文本框。

The style appears to work in IE7 and Firefox but not in IE8. 该样式似乎可以在IE7和Firefox中使用,但不能在IE8中使用。

The css is: CSS是:

input.text, input.file, textarea.textarea, select.select 
{
    font-family:"lucida grande",tahoma,verdana,arial,sans-serif;
    color:#333;
    margin:0;
    padding:4px;
}

input.text, textarea.textarea, select.select{
    border-top:1px solid #7c7c7c;
    border-left:1px solid #c3c3c3;
    border-right:1px solid #c3c3c3;
    border-bottom:1px solid #ddd;
}

The style appears to apply fine to textboxed but not selects/ 该样式似乎可以很好地应用于文本框,但不能选择/

Any ideas about why this is happening in IE8? 关于IE8中为什么会发生这种情况的任何想法?

                                    <label class="desc" >
                                        First name</label>
                                    <input type="text" name="nuFirstname" id="nuFirstname" class="text pop" value="" /></li>
                                <li>
                                    <label class="desc" >
                                        Surname</label>
                                    <input type="text" name="nuSurname" id="nuSurname" class="text pop" value="" /></li>
                                <li>
                                    <label class="desc" >
                                        Colour</label>
                                    <select class="select pop" id="nuDept" name="nuDept">
                                        <option value="-" selected="selected">-</option>
                                        <option value="2">Green</option>
                                        <option value="3">White</option>
                                        <option value="4">Orange</option>

                                    </select></li>

If you want your select boxes to look the same cross browser, I suggest using a jQuery plugin ( something like this ) to do so. 如果您希望选择框看起来与跨浏览器相同,建议您使用jQuery插件( 类似这样 )。 Unfortunately, you will never have consistent results with select boxes if you try to control them with just CSS. 不幸的是,如果仅使用CSS来控制选择框,则永远不会获得一致的结果。 It's just the way of the web... for now. 暂时只是网络方式。

Have a read of this and check to see what 'mode' of IE you're in to see how it's interpreting the code. 阅读此内容并检查您所使用的IE的“模式”,以了解其如何解释代码。 I don't believe this applies to newer versions of IE (ie >=9ish probably) 我不认为这适用于IE的较新版本(例如,> = 9ish)

http://www.quirksmode.org/css/quirksmode.html http://www.quirksmode.org/css/quirksmode.html

Ok seems like someone was having the same problem. 好吧,好像有人遇到了同样的问题。

IE8 and border css property on select menus 选择菜单上的IE8和Border CSS属性

The solution appears to be putting this line in the header: 解决方案似乎是将以下行放在标题中:

What on earth is going on with IE8? IE8到底是怎么回事?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM