<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title> <style>Body{Font:14px/22px "Microsoft Yahei"; }P{width:300px;margin:50px Auto; }. Test1{-webkit-line-clamp:3; /*The number of lines used to limit the text displayed in a block element*/Display:-webkit-box; /*You must combine the properties to display the object as an elastic telescopic box model*/-webkit-box-orient:Vertical; /*you must combine properties to set or retrieve the arrangement of child elements of a telescopic box object*/Overflow:Hidden; }. Test2{position:relative;Line-height:20px;Max-height:40px; /*Max-height/height is set to an integer multiple of line-height to prevent half of the text from appearing*/Overflow:Hidden; }. Test2::after{content: "...";position:Absolute; Right:0;Bottom:0;Padding-left:20px;background:linear-gradient (to Right,transparent, #fff 55%); }. Test3{ /*implemented with JavaScript*/ } </style> <Script>window.onload=function(){ varOtxt=document.getElementById ("txt"); functionSub (num) {otxt.innerhtml=oTxt.innerHTML.substring (0, num); } Sub ( -); }; </Script></Head><Body> <Pclass= "Test1">Baidu Encyclopedia is a Baidu company launched a content open, free network encyclopedia platform, its beta version on April 20, 2006 on-line, the official version was released on April 21, 2008, as of November 2014 included the number of entries has reached 10 million. Baidu Encyclopedia aims to create a Chinese information collection platform covering all areas of knowledge. Baidu Encyclopedia emphasizes the user's participation and dedication, fully mobilize the power of Internet users, gather billions of users of the wisdom of the mind, and actively communicate and share. At the same time, Baidu Encyclopedia to achieve with Baidu search, Baidu know the combination, from different levels to meet user demand for information. </P> <Pclass= "Test2">Baidu Encyclopedia is a Baidu company launched a content open, free network encyclopedia platform, its beta version on April 20, 2006 on-line, the official version was released on April 21, 2008, as of November 2014 included the number of entries has reached 10 million. Baidu Encyclopedia aims to create a Chinese information collection platform covering all areas of knowledge. Baidu Encyclopedia emphasizes the user's participation and dedication, fully mobilize the power of Internet users, gather billions of users of the wisdom of the mind, and actively communicate and share. At the same time, Baidu Encyclopedia to achieve with Baidu search, Baidu know the combination, from different levels to meet user demand for information. </P> <Pclass= "Test3"><spanID= "txt">Baidu Encyclopedia is a Baidu company launched a content open, free network encyclopedia platform, its beta version on April 20, 2006 on-line, the official version was released on April 21, 2008, as of November 2014 included the number of entries has reached 10 million. Baidu Encyclopedia aims to create a Chinese information collection platform covering all areas of knowledge. Baidu Encyclopedia emphasizes the user's participation and dedication, fully mobilize the power of Internet users, gather billions of users of the wisdom of the mind, and actively communicate and share. At the same time, Baidu Encyclopedia to achieve with Baidu search, Baidu know the combination, from different levels to meet user demand for information. </span><span>...</span></P></Body> </HTML>
The implementation method of multi-line text overflow point point 3