CSS文本溢出省略号-跨浏览器方案

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript"></script>
<style type="text/css">
.textoverflow a {
     display:block;
     width:120px;
     margin: 0px 0px 0px 3px;
     white-space: nowrap;
     overflow: hidden;
     float: left;
     -o-text-overflow: ellipsis;    /* for Opera */
     text-overflow: ellipsis;        /* for IE */
}

.textoverflow:after{ 
    content: "…"; 
}/* for Firefox */

@media all and (min-width: 0px){ 
    .textoverflow:after{ 
        content:""; 
    }/* for Opera */ 
}
</style>
</head>

<body>
    <div class="textoverflow">
        <a> dfdlaiewuroiewqfjkdlsjfdksaifudsadfs</a>
    </div>
</body>
</html>
posted @ 2012-07-04 00:00  水之原  阅读(1027)  评论(2编辑  收藏  举报