Set dot color of `text-overflow: ellipsis`

后端 未结 1 950
被撕碎了的回忆
被撕碎了的回忆 2020-12-16 09:22

I have a div with a fixed width, which has a div with text inside. Parts of the text are in a span for coloring. The text div

1条回答
  •  半阙折子戏
    2020-12-16 09:56

    If I understand your issue correctly, this might work for you:

    .container {
        width:120px;
        background: lightgray;
    }
    .text {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        color:#b02b7c;
    }
    .color {
        color: black;
    }
    Lorem ipsum dolor sit amet, consetetur

    Demo Fiddle

    If the ellipsis is taking the color of the div, then make the div the color you want the ellipsis to be, and use .color to set the initial text black.

    0 讨论(0)
提交回复
热议问题