34

Improving page performance with asynchronously loaded CSS

 4 years ago
source link: https://www.tuicool.com/articles/73iyUjI
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

:bulb: Tip of the Week

supported by QvIjE3U.png!web

How to truncate multiple lines of text

As noted here by Šime Vidas , multi-line text truncation is now widely supported across a wide array of browsers, including Firefox, Chrome & Safari.

Global support now stands just shy of 90% — so how do you use it? Here's a quick example via the MDN docs :

p {

width: 300px;

display: -webkit-box;

-webkit-box-orient: vertical;

-webkit-line-clamp: 3;

overflow: hidden;

}

Using ' -webkit-line-clamp ' like this allows for limiting the contents of a block container to the specified number of lines. The result:

fIVZrai.png!web

You can read more about this property in the CSS Overflow Module Level 3 specification. Chris Coyier also looks at an alternative approach here .

This tip of the week is sponsored byPantheon, the WebOps platform built for agility. Learn how WebOps can benefit you & why traditionalhosting is dead.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK