【发布时间】:2013-06-07 05:45:17
【问题描述】:
我有一些代码在 Chrome 中完全符合要求,但在 IE9 中没有。
我的目标是有一个网格单元格,它根据最大列宽剪辑其文本,不换行文本并在工具提示中显示全文。 在 Internet Explorer 中,单元格不会被剪裁,而是在页面上被拉伸得很远,导致需要滚动。
我使用的css是这样的:
.gridMaxWidth150
{
max-width: 150px;
overflow: hidden;
text-overflow: clip;
white-space: nowrap;
}
gridview 列:
<asp:TemplateField
HeaderText="Comments"
ItemStyle-CssClass="gridMaxWidth150"
ItemStyle-Wrap="false" >
<ItemTemplate>
<asp:Label ID="lblComment" runat="server"
Text='<%# Bind("Comments") %>'
Tooltip='<%#: Bind("Comments") %>' />
</ItemTemplate>
</asp:TemplateField>
如果可能,我想在绑定时不更改文本来执行此操作。我只是不明白为什么 IE 有问题。 模式和标准是IE9。
编辑:根据Kinlan的帖子更改了css,仍然看到这个:
当 'white-space: nowrap' 开启时,它似乎没有响应 'max-width'。 (如果我取消选中 nowrap 然后它会换行文本并且宽度会缩小到 150px)
【问题讨论】:
标签: asp.net internet-explorer css google-chrome