[英]overflow: hidden; text-overflow: ellipsis; white-space: nowrap; not working inside fieldset?
[英]text-overflow: ellipsis is not working to pre tag or white-space pre text all lines in IE & Edge
在 IE 中, text-overflow: ellipsis
不適用於<pre>
標簽文本和white-space: pre
文本。 僅對於第一行,它工作正常,而對於其余行,它在 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>
為每個新行添加span
。
.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.