Why input[type=text] is not working in IE

2019-05-23 00:14发布

I have some style like this:

<style type="text/css">
input[type=text]{
width:300px;
}
</style>

the above code works in chrome and firefox. Why not in IE? I am using this code in Reporting services at the end of Reports.aspx file.

4条回答
仙女界的扛把子
2楼-- · 2019-05-23 00:57

Use the IE7-JS script. (It was originally created to add some features of IE7 to IE6, thus the name.)

It can add this feature to both IE6 and IE7. (Note that IE9.js is newest and it also fixes a bunch of other things in how IE interprets CSS.)

查看更多
冷血范
3楼-- · 2019-05-23 01:00

Double check that you don't have a space between the "input" and the "[". This burned me lately. Worked in FF/Chrome but not IE.

查看更多
Luminary・发光体
4楼-- · 2019-05-23 01:02

Which version of IE?

IE6 and lower do not support attribute selectors.

Just use a class, keep it simple:

input.text
{
   width:300px;
}

<input type="text" class="text" />
查看更多
放我归山
5楼-- · 2019-05-23 01:03

It works fine in IE8, assuming the page is loading in IE7 or IE8 standards mode (not quirks)

Edit

You've said you're using IE8. In which case, use the developer tools (F12), locate your text box, and check what styles are being applied.

Edit 2

Don't know which version of reporting services you're using. Just went to a 2000 instance, and the report manager is serving up pages that render in quirks mode, so good luck getting much, if any, styling to work.

Edit 3

You may be able to force IE to render in IE8 mode by adding a meta tag to the head within the aspx pages. E.g. :

<head>
<meta http-equiv="X-UA-Compatible" content="IE=100" >
<!-- Rest of <head> -->
查看更多
登录 后发表回答