Nic*_*o O 12
受这个答案启发,这是一种样式省略号的方式.这个解决方案的缺点是
<span>(或任何)元素.text-overflow
{
color: blue;
font-weight: bold;
font-size: 20px;
overflow: hidden;
text-overflow: ellipsis;
width: 100px;
white-space: nowrap;
}
.text-overflow > span
{
font-weight: normal;
color: black;
font-size: 14px;
}Run Code Online (Sandbox Code Playgroud)
<div class="text-overflow"><span>Here is some very nice text indeed. So this is getting long</span></div>Run Code Online (Sandbox Code Playgroud)