Clamping lines without '-webkit-line-clamp'

line-clamp mdn
line-clamp js
angular line-clamp
react line-clamp
text-overflow ellipsis two lines javascript
css max-lines
line-clamp css codepen
multiline ellipsis javascript

In the good old days, there existed a trick in webkit for clamping lines using pure css:

display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;

Though this syntax happily coexists with the display: -webkit-flex syntax, in all modern webkit-based browsers, it is considered obsolete.

My question is:

How can I achieve line clamping in pure CSS and without the obsolete '-webkit-line-clamp' trick?


The only cross-browser solution is to use js afaik. Several solutions to the problem of multi-line truncation with ellipsis are discussed here: http://css-tricks.com/line-clampin/

I hate them all, but welcome to web development.

Line Clampin' (Truncating Multiple Line Text), That's "line clamping" and it is a perfectly legit desire. it's weird. why does it need to be a flexbox thing (the old version at that)? It doesn't work without that. Now you can clamp up projects without sticking bumper boards between the clamps and the wood. Buy a pack of 3M Surface Gard medium duty felt pads ($3 a pack at home centers, or call 800-3M-HELPS), and cut out pieces to cover the clamp faces (scuff the jaw surfaces with sandpaper first).


Try using this CSS

.line-clamp:after {
background: linear-gradient(to right, rgba(255, 255, 255, 0), #FFFFFF 50%) repeat scroll 0 0 rgba(0, 0, 0, 0);
bottom: 0;
content: "...";
font-weight: bold;
padding: 0 20px 1px 45px;
position: absolute;
right: 0;}

.line-clamp {
height: 5.6em;
line-height: 1.4em;
overflow: hidden;
position: relative;}

-webkit-line-clamp, The only cross-browser solution is to use js afaik. Several solutions to the problem of multi-line truncation with ellipsis are discussed here:  Spigot replace tips. IWISS PEX Clamp Cinch Tool Crimping Tool Crimper for Stainless Steel Clamps from 3/8"to 1" - Duration: 2:03. IWISS 9,372 views


The CSS Overflow Level 3 specification defines a standard line-clamp property (without the quirks the ´-webkit-` prefixed solution has). Unfortunately, non of the main browsers supports this feature yet.

So, for now you will have to use a polyfill for browsers that don't support this property. CSS-Tricks describes three solutions, each one having its pros and cons.

  1. Using standard CSS

    .fade {
      position: relative;
      height: 3.6em; /* exactly three lines */
    }
    
    .fade::after {
      content: "";
      text-align: right;
      position: absolute;
      bottom: 0;
      right: 0;
      width: 70%;
      height: 1.2em;
      background:
        linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 50%);
    }
    

    Pros: All current browsers support this. Cons: There's a fade-out instead of an ellipsis and requires heights to be set manually.

  2. Using Opera's -o-ellipsis-lastline value

    .last-line {
      height: 3.6em; /* exactly three lines */
      text-overflow: -o-ellipsis-lastline;
    }
    

    Pros: Display as expected. Cons: Only works in old versions of Opera and requires height to be set manually

  3. Using JavaScript (Clamp.js)

    var module = document.getElementById("clamp-this-module");
    $clamp(module, {clamp: 3});
    

    Pros: Display as expected and is flexible through different options. Cons: Requires a JS library to work and is less performant than CSS solutions.

Clamping lines without '-webkit-line-clamp', No RTL Support: It does not support any text with a direction: rtl property. The -​webkit-line-clamp gets ignored altogether. You can see this in  How to paint parking lines without a machine In this particular situation we do not want to change colors in our parking lot striping machine so we elected to tape off five parking lines and


CSS Line-Clamp, CSS line-clamp. - UNOFF. Proprietary and undocumented CSS property that will contain text to a given amount of lines when used in combination with display:  How to Lay Tile Without Grout Lines. Grout is a necessary and integral part of many tile jobs for several reasons: It keeps moisture out of the substrate, helps keep tile lines straight and


CSS line-clamp, or third line. And, I've had to tell them over and over again “Sorry, no.” Mainly, it takes the -webkit-line-clamp property (yes, -webkit ), like so:. Clamping/pinching/crushing the line shut is not a great idea. I consider it an incredibly bad idea. Like you said, open the bleed valve when retracting the piston, or separate the caliper from the line altogether. If you think about it, clamping the line shut is going to prevent you from retracting the piston anyway.


How to Truncate Type at More Than One Line with Just CSS, Responsive and accessible clamping component with Read more/Read less buttons built for React. Location: Mount Holly, NC. Posts: 26,365. certainly do NOT clamp the brake hoses first off, it will not work. the hose is very hard, and reinforced. second, the hose is very fragile, and is very likely to be damaged by even hanging the weight of the caliper, deliberate clamping of the hose is highly unwise.