1. 程式人生 > >如何讓一行文字顯示一定的寬度,超出省略號代替

如何讓一行文字顯示一定的寬度,超出省略號代替

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
<title></title>  
<style type="text/css">  
#box{
    width:100px;
    background-color:#87CEEB;
    padding:2px 3px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}   
</style>  
</head>  
<body>  
  <div id="box">fd之fa星旅館有限公司系亞洲規模最大的綜合性旅遊企業集團</div>  
</body>  
</html>