這兩個屬性再搭配overflow主要的用途是將過多的資料來用 "..."來顯示,如下圖:
實作方式如下段程式碼:
- <!DOCTYPE html>
 - <html>
 - <head>
 - <title>Test</title>
 - <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 - <style>
 - .title { overflow:hidden;
 - width:300px;
 - border:2px solid #f00;
 - text-overflow:ellipsis;
 - white-space:nowrap }
 - </style>
 - </head>
 - <body>
 - <div class="title">
 - 這是一個用來測試Overflow顯示的範例唷!這是一個用來測試Overflow顯示的範例唷!
 - </div>
 - </body>
 - </html>
 

沒有留言:
張貼留言