Center Text Larger than Container? (Without using separate child element)

后端 未结 3 835
鱼传尺愫
鱼传尺愫 2021-02-08 14:21

Using CSS, it\'s easy to horizontally center text in a container using text-align:center;, but if any single word of that text is larger than the width of the c

3条回答
  •  再見小時候
    2021-02-08 14:35

    I use this solution:

    .limited-string {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 90%;
    }
    

提交回复
热议问题