Text-overflow: ellipsis jumps behind text on Andro

2020-07-19 05:55发布

im trying to ellipsis a h2 tag with text-overflow. It works fine i all browsers but on Android.

The three dots jumps behind the clipped text so you can't actually see the ellipsis.

The css for the h2 is:

    h2 {
    font-size: 20px;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 40%;     
}

I have a lot of other styles but can't figure out what will affect this.

I did a dummy test which works fine, so i was wondering if someone experienced this behaviour before?

2条回答
乱世女痞
2楼-- · 2020-07-19 06:00

So i managed to figure it out, by running through the css line by line. It turns out that text-rendering: optimizeLegibility; causes the bug! Removed it and now it works perfectly!

查看更多
戒情不戒烟
3楼-- · 2020-07-19 06:19

this worked for me

Basically add text-rendering: auto; to your css that has the ellipsis

https://github.com/driftyco/ionic/issues/663

查看更多
登录 后发表回答