CSS text-overflowにclipを指定して文章を途中で終了させる

環境
Google Chrome 106.0.5249.119
Windows 10 Home 64bit

書式
text-overflow: clip;
text-overflowにclipを指定しています。文章は途中で終了しています。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<head>
<style>
.tt {
width: 80px;
border: 1px solid;
white-space: nowrap;
overflow: hidden;
text-overflow: clip;
}
</style>
</head>
<body>
<p class="tt">123456789</p>
</body>
</html>
<!DOCTYPE html> <html> <head> <style> .tt { width: 80px; border: 1px solid; white-space: nowrap; overflow: hidden; text-overflow: clip; } </style> </head> <body> <p class="tt">123456789</p> </body> </html>
<!DOCTYPE html>
<html>
<head>
<style>
  .tt {
    width: 80px;
    border: 1px solid;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
  }
</style>
</head>
<body>

<p class="tt">123456789</p>
</body>
</html>

結果
「12345678」が表示されます。
文章は途中「12345678」で終了しています。

 

CSS

Posted by arkgame