开发者

android/webkit text-overflow: ellipsis not working

开发者 https://www.devze.com 2023-01-22 20:01 出处:网络
i am trying to get the following code to work on an androind 2.1 phone (HTC Sense UI): h1 { font-size: 14px;

i am trying to get the following code to work on an androind 2.1 phone (HTC Sense UI):

h1 {
    font-size: 14px;
    font-weight: bold;
    color: #FFF;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;   
}

however, the text-overflow property does not seem to work. has anybody else had this 开发者_运维问答problem, or found a way to work around it?


on Android 2.2 and 4, I use a line height greater than the font size (always em) with a display type "-webkit-box" and a vertical orientation.

Here is an example:

.myClass{
display     : -webkit-box;
-webkit-box-orient  : vertical;
text-overflow   : ellipsis;
-webkit-line-clamp  : 3;
overflow        : hidden; 
font-size       : 0.9em;
line-height     : 1.2em;
}


I see you have no width defined. If the element is allowed to get arbitrarily wide there is never going to be any overflow >within> the element. The element overflowing its parent wil not give you the desired effect.


It seems that the 'ellipsis' is not working when your 'display' is set to '-webkit-box', reset to 'block' will do. This may help: https://bugzilla.mozilla.org/show_bug.cgi?id=672944#c0

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号