简体   繁体   English

文本溢出:省略号无法在 IE 和 Edge 中对所有行进行预标记或空白预文本

[英]text-overflow: ellipsis is not working to pre tag or white-space pre text all lines in IE & Edge

In IE, text-overflow: ellipsis is not working for <pre> tag text and white-space: pre text.在 IE 中, text-overflow: ellipsis不适用于<pre>标签文本和white-space: pre文本。 Only for the first line, it is working fine and for the rest of the lines, it is not working in the Chrome browser, it is working fine for all the browsers.仅对于第一行,它工作正常,而对于其余行,它在 Chrome 浏览器中不起作用,它适用于所有浏览器。

在此处输入图片说明

 .myText { white-space: pre; color: blue; -ms-text-overflow: ellipsis; text-overflow: ellipsis; overflow: hidden; }
 <!DOCTYPE html> <html lang="en"> <head> <title>Angular Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> </head> <body> <div > <div class="container"> <h1>Pre Tag or Pre Text with Textoverlow ellipsis:</h1> <div style="WIDTH: 100PX;"> <div class="myText">print "Hello world, how are you doing today? Is this getting cut off yet? Hello world, how are you doing today? </div> </div> </div> </body> </html>

Add span to every single new line.为每个新行添加span

JSFiddle JSFiddle

 .myText span { white-space: pre; text-overflow: ellipsis; overflow: hidden; color: blue; display: block; }
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <div class="container"> <h1>Pre Tag or Pre Text with Textoverlow ellipsis:</h1> <div style="WIDTH: 100PX;"> <div class="myText"> <span>print "Hello world, how are you doing today?</span> <span>Is this getting cut off yet?</span> <span>Hello world, how are you doing today?</span> </div> </div> </div>

暂无
暂无

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

相关问题 溢出:隐藏; 文字溢出:省略号; 空白:nowrap; 在fieldset内不工作? - overflow: hidden; text-overflow: ellipsis; white-space: nowrap; not working inside fieldset? CSS Transition 不适用于空白:nowrap 和文本溢出:悬停时省略号 - CSS Transition not working with white-space: nowrap and text-overflow: ellipsis when hover 在移动设备中,空白:nowrap; 溢出:隐藏 文字溢出:省略号; 有点不起作用 - in mobile devices, white-space:nowrap; overflow:hidden; text-overflow:ellipsis; kinda do not work 两个Div相邻,并带有“文本溢出:省略号; 溢出:隐藏; 空白:nowrap;” - Two Div's next to each other with “text-overflow: ellipsis; overflow: hidden; white-space: nowrap;” 如果我们有 br 标签,文本溢出省略号点不会在 IE 和 Edge 浏览器中显示 - text-overflow ellipsis dots not showing in IE & Edge browsers if we have br tag 文本溢出:省略号不起作用 - text-overflow: ellipsis not working 文本溢出为省略号不起作用 - text-overflow as ellipsis not working 空格:预包装在IE中不起作用 - white-space: pre-wrap not working in IE 文本溢出:省略号不适用于IE中的输入,但在其他语言中则可以正常工作 - text-overflow: ellipsis is not working for input in IE but working fine in other Text-Overflow Ellipsis不适用于Firefox和IE浏览器中的多行 - Text-Overflow Ellipsis not working for multi-lines in Firefox and IE browsers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM