html - 选择标签中的最大宽度在 IE 中不起作用

标签 html css internet-explorer

我有一个选择标签,... 像这样,..

<select style="max-width:150px"> 
     <option value='1'>bla bla bla bla bla bla bla ...(let's say a long words)
     ...... 
</select>

它在 FF 中有效,..但不是,即...比我用宽度更改最大宽度 style="width:150px"
它在两者中都有效,..但是,..
即...文本被截断

谁能帮帮我? 我做错了吗? 有没有更好的方法来修复它?

对不起,如果我的英语不好:(

最佳答案

这篇文章可以解释为什么 max-width 在您使用的 IE 版本中不起作用:

max-width in Internet Explorer

它显示了如何使用 CSS 表达式在 IE 中模拟最大宽度的示例:

<html>
<style>
body {
width:100%;
margin:0;
padding:0;}

p {
border:1px solid red;
max-width:800px;
width:expression(document.body.clientWidth > 800? "800px": "auto" );
}
</style>
<body>
<p>
[a lot of text]
</p>
</body>
</html>

免责声明:I'm not a fan of CSS expressions ,但无论如何这应该有效。

关于html - 选择标签中的最大宽度在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4446407/

相关文章:

css - 谷歌浏览器不尊重 z-index

javascript - 为什么我自制的下拉列表在 IE 7 中不起作用

javascript - Internet Explorer 6、7 和 8 中的 Object.onload

如果输入字段为空,PHP 不会回显;与 PRG 模式

html - 垂直对齐固定的 div

html - 将打印区域限制为一个 div

html - 我怎样才能让这个图像背景只出现在该部分的一半?

html - 使用 CSS 使图像消失而无需悬停

html - 为什么我的商店在 FireFox 中这么长?

.htaccess - 适用于 Internet Explorer 11 的 SSLCipherSuite