How can I show dots (“…”) in a span with hidden overflow?

后端 未结 8 1315

My CSS:

#content_right_head span
{
  display:inline-block;
  width:180px;
  overflow:hidden !important;
}

Now it\'s showi

8条回答
  •  遥遥无期
    2020-12-02 04:44

    For this you can use text-overflow: ellipsis; property. Write like this

    span {
        display: inline-block;
        width: 180px;
        white-space: nowrap;
        overflow: hidden !important;
        text-overflow: ellipsis;
    }
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book

    JSFiddle

提交回复
热议问题