【发布时间】:2010-12-15 12:35:23
【问题描述】:
我在 IE 中的输入字段出现问题。该代码是针对一个 portlet 的,并且宽度需要是动态的,因为用户可以将 portlet 放置在页面中三个具有不同宽度的列中的任何一个上。与往常一样,它在 FF 中运行良好,但在 IE 中却不行。为了使宽度动态,我设置了 width="100%"。填充文本输入的数据来自数据库。当页面被渲染时,如果有一个长 URL,文本输入会扩展以填充 IE 中的内容,但在 FF 中它只是保持相同的宽度(即它所在的 TD 的 100%)。如何阻止 IE 更改宽度以适应内容。将宽度设置为 100 像素的固定宽度可以解决此问题,但我需要将宽度设置为百分比,以适应页面上任何位置的 portlet 的布局。
我已经尝试过溢出:隐藏和自动换行:断字,但我无法工作。这是我的输入代码和样式表
<td class="right" >
<input type="text" class="validate[custom[url]]" value="" id="linkText" name="communicationLink" maxlength="500" maxsize="100" />
</td>
.ofCommunicationsAdmin input {
font-family: "Trebuchet MS";
font-size: 11px;
font-weight:normal;
color:#333333;
overflow:hidden;
}
.ofCommunicationsAdmin #linkText {
overflow:hidden;
width:100%;
border:1px
#cccccc solid;
background:#F4F7ED
top repeat-x;
}
.ofCommunicationsAdmin td.right {
vertical-align: top;
text-align: left;
}
【问题讨论】:
-
您能否发布指向示例页面的链接,或者至少是正确与错误的屏幕截图(FF 与 IE)?
-
我无法提供链接,因为它是一个内部应用程序,我有一个屏幕截图,但我意识到我无法上传它,而且我也无法访问工作中的图像托管!基本上在 IE 中,当其中一个表单字段中有 URL 时,我的整个表格的宽度会增加三倍。在 FF 中,它保持不变,您必须将光标放在文本输入中并向右滚动才能看到文本。 FF 行为是我想要的。
标签: html css internet-explorer forms stylesheet