0
我在IE8使用文本溢出和溢出隐藏时出现问题。尽管IE8正确修剪文本并隐藏了视图中的溢出,但截断文本的跨度仍会在父元素上吹出宽度。没有固定宽度的IE8文本溢出
在span或其父元素上使用固定宽度可以正常工作,但不幸的是我无法使用固定宽度。我曾尝试在截断span元素上使用宽度:100%和max-width,并在父元素上放置最大宽度,但在IE8中没有运气。
任何建议将是非常有益的。
小提琴这里:
http://jsfiddle.net/cmoeser/aRvXg/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<style type="text/css">
.containerDiv {
float:right;
border:1px solid green;
overflow:hidden!important;
zoom:1;
}
.textDiv {
float:left;
zoom:1;
white-space: nowrap;
display:block;
max-width:128px;
overflow:hidden;
-ms-text-overflow: ellipsis;
text-overflow:ellipsis;
}
</style>
<body>
<div class="containerDiv">
<span class="textDiv">WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW</span>
</div>
</body>
</html>
钍anks。在任一方向浮动或文本对齐都不起作用。 – Chip
尝试使用父宽度上的最大宽度,然后使用宽度:自动 –
http://snook.ca/archives/html_and_css/ie8-bug-max-width-overflow 听起来类似于你的bug可能有帮助 –