限制 link 的宽度并在溢出时截断文本

Limit the width of a link and truncate text if it overflows

我正在使用以下代码在我的 wordpress 主题中显示 next/previous posts。

<?php
  previous_post_link('<span class="left">&larr; %link</span>');
  next_post_link('<span class="right">%link &rarr;</span>'); 
?> 

我想将 link 中显示的 post 标题限制为特定长度,因为我有 space。 我想在 link 中添加箭头,以便它显示 link 和具有相同样式的箭头。

您可以添加截断文本的样式,如下所示

a.ellipsis {
    max-width: 100px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: inline-block;
}
<span class="left">&larr; <a href='#' class="ellipsis">My big back link</a></span>