Search results
13 paź 2010 · There's a way to do it using unofficial line-clamp syntax, and starting with Firefox 68 it works in all major browsers. body {. margin: 20px; } .text {. overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; /* number of lines to show */. line-clamp: 2;
You can use the line-clamp CSS property to limit the length of a text to N lines with CSS. The line-clamp property limits the contents of a block to the specified number of lines. index.html.
7 maj 2013 · CSS only, accounts for the case where you have text as long as the number of lines you want to show (you don’t want dots then), and you can implement a -webkit-line-clamp switch into it easily.
30 wrz 2024 · To truncate text after multiple lines, you can use -webkit-line-clamp, a WebKit-specific property that limits the text to a certain number of lines. However, this approach is not widely supported across all browsers and primarily works in WebKit-based browsers like Chrome and Safari.
17 sie 2019 · The line-clamp property truncates text at a specific number of lines. The spec for it is currently an Editor’s Draft, so that means nothing here is set in stone because it’s a work in progress.
Sometimes, we have to trim text to limit the number of lines. There are a few ways to do it with pure CSS. Let's learn how to achieve that. The easiest way to limit text to n lines is to use line-clamp. N can be any positive number, but it will be two or three lines most of the time.
13 paź 2023 · How about multiple lines that you want to constrain to a known number of lines and then truncate? Well, in this post I’ll show you how to do both with nothing but CSS. Let’s check it out!