「CSS」ellipsisで文末にドット3つ(…)を表示する

書式
text-overflow: ellipsis;
text-overflowにellipsisを指定して文末はドット3つ(…)になります。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<head>
<title>ellipsisで文末にドット3つ(...)を表示する</title>
</head>
<body>
<style>
.cft {
width: 85px;
border: 1px solid;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<p class="cft">this is a test</p>
</body>
</html>
<!DOCTYPE html> <html> <head> <title>ellipsisで文末にドット3つ(...)を表示する</title> </head> <body> <style> .cft { width: 85px; border: 1px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } </style> <p class="cft">this is a test</p> </body> </html>
<!DOCTYPE html>
<html>
<head>
<title>ellipsisで文末にドット3つ(...)を表示する</title>
</head>
<body>

<style>
  .cft {
    width: 85px;
    border: 1px solid;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
</style>
<p class="cft">this is a test</p>

</body>
</html>

 

CSS

Posted by arkgame