Text-overflow: ellipsis jumps behind text on Android

谁都会走 提交于 2020-01-01 16:02:19

问题


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?


回答1:


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!




回答2:


this worked for me

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

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



来源:https://stackoverflow.com/questions/11860438/text-overflow-ellipsis-jumps-behind-text-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!