Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7761431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:08:02+00:00 2026-06-01T14:08:02+00:00

Here is the problem: I have a list of items with various length for

  • 0

Here is the problem:

  • I have a list of items with various length for then name.
  • I want to trim the names to 140 pixels if they are longer.
  • As a nice clean way
    of demonstrating to users that the string is trimmed, I want to
    reduce transparency of the last few characters of the name, or at
    least create that illusion.
  • I do not want to use the ellipsis… effect for several good reasons.

I this possible in pure CSS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:08:03+00:00Added an answer on June 1, 2026 at 2:08 pm

    Sure can, using CSS. You have two options, but really only the first will get the best results cross-browser.

    The idea is to overlay a pseudo-element over the right of your element containing the string. This will only work if it’s on a solid background color, as we will use that color to “fade” to.

    HTML

    <span>This string ends with an gradient to the background color overlayed</span>
    

    CSS

    span {position:relative;}
    span.overlay:after {
        content:"\0020";
        display:block; width:50px; 
        position:absolute; right:0px; top:0px; bottom:0px; z-index:2;
        background-image:-webkit-linear-gradient(right, rgba(255,255,255,1), rgba(255,255,255,0));
        background-image:-moz-linear-gradient(right, rgba(255,255,255,1), rgba(255,255,255,0));
        background-image:-ms-linear-gradient(right, rgba(255,255,255,1), rgba(255,255,255,0));
        background-image:-o-linear-gradient(right, rgba(255,255,255,1), rgba(255,255,255,0));
        background-image:linear-gradient(right, rgba(255,255,255,1), rgba(255,255,255,0));
        /* Or use an actual png image fading to white for IE < 10 support */
    }
    

    the :after element will work in all browsers, IE8+. The -ms-gradient only in IE10+, so either figure out how to use the old ie gradient filters, or use a PNG image.

    There’s also another newer CSS method, but currently only supported by webkit (Chrome & Safari), mask-image. Here, you can use an image or a CSS gradient to mask an element. Same principal, except you can actually fade the element (in the case your text was on a patter).

    span{
        -webkit-mask-image: -webkit-linear-gradient(right, rgba(0,0,0,0) 0px, rgba(0,0,0,1) 50px);
    }
    

    You can check out this jsfiddle: http://jsfiddle.net/rgthree/b96sv/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the problem: I have a list of items on a page, each with
I need help with CMD scripts. Here is my problem: I have list of
Okay, so here's my problem: I have a list of members on a website,
I have problem adding arraylist to list view, will explain about my problem here..
Here's my problem: I have do create a menu/list of actions (which would be
OK the question title is vague, but here's the problem. I have a list
I have the following problem: I have to list several items each with several
I have a list of items displayed horizontally. I want to create a border
So I will have a list of items to check off. They could have
I have a problem retrieving items from a fairly large list. I can quickly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.