简体   繁体   English

线夹在 Firefox 和 Safari 浏览器 iphone 的移动视图中不起作用

[英]line-clamp not working in mobile view for firefox and also in safari browser iphone

line-clamp is not working in safari browser for iphone and in mobile view of firefox. line-clamp 在 iphone 的 safari 浏览器和 firefox 的移动视图中不起作用。

This is my code这是我的代码

html in angular: html 中的角度:

<div class="clip_text_2_line" [innerHTML]="viewdata.company_desc | sainitizeHtml"></div>

My Css我的 CSS

.clip_text_2_line{
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: clip!important;
    display: -webkit-box!important;
    line-clamp: 2!important;
    -webkit-line-clamp: 2!important;
    -webkit-box-orient: vertical!important;
}

The incoming data is from text editor, so will contain html content, thats why i had to use innerHTML and sainitizeHtml .传入的数据来自文本编辑器,因此将包含 html 内容,这就是我必须使用innerHTMLsainitizeHtml The data may contain Engilsh or Japanese characters.数据可能包含英文或日文字符。

Here is what it looks like.这是它的样子。

在此处输入图片说明

You can see in the top portion, the text is breaking with ... and then it continues again.您可以在顶部看到,文本与...断开,然后再次继续。

It works fine in moto g5 plus and other devices, as given below.它在 moto g5 plus 和其他设备中运行良好,如下所示。 This is what i expect all devices to show.这是我希望所有设备都能显示的内容。

在此处输入图片说明

Safari/Firefox adds a margin. Safari/Firefox 增加了一个边距。 Add the following css.添加以下css。

.clip_text_2_line > p {
    margin: 0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM