Skip to main content Skip to docs navigation

テキスト省略

Text truncation

長い文字列のテキストを省略記号で切り捨てます。

長い内容の場合は、.text-truncateクラスを追加して、テキストを省略記号で切り詰めることができます。display: inline-blockまたはdisplay: blockを必要とします。

This text is quite long, and will be truncated once displayed.
This text is quite long, and will be truncated once displayed.
html
<!-- Block level -->
<div class="row">
  <div class="col-2 text-truncate">
    This text is quite long, and will be truncated once displayed.
  </div>
</div>

<!-- Inline level -->
<span class="d-inline-block text-truncate" style="max-width: 150px;">
  This text is quite long, and will be truncated once displayed.
</span>