1
<div className="abcd">
<span>
<span className="abc"></span><span className="abc"></span><span className="abc"></span><span className="abc"></span><span className="abc"></span><span className="abc"></span>
</span>
</div>

If i set a max height for the div, similar to text-overlfow: 'ellipsis', how can i show some span elements and then show ellipsis alongside it.

span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        }

This does not work. Within the div i would like ellipsis to appear when max-height is reached. This works fine for <p className"para">blahblahblah</p> So if we set get something like blahblah...

I want a similar result.

2
  • Could you please provide css as well for classes abc, abc1, abc2 and abc3 Commented Mar 8, 2018 at 22:19
  • 1
    the short answer is you cannot ... here is a similar question to get some idea of workaround : stackoverflow.com/questions/48868798/… Commented Mar 8, 2018 at 22:22

2 Answers 2

0

If you are using webkit based browsers, you can use -webkit-line-clamp

overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;

https://codepen.io/nagasai/pen/vRYedp

Reference - Is vertical text-overflow possible with css3? and https://medium.com/mofed/css-line-clamp-the-good-the-bad-and-the-straight-up-broken-865413f16e5

Use options provided in below question for all browsers without using -webkit-line-clamp

Clamping lines without '-webkit-line-clamp'

Sign up to request clarification or add additional context in comments.

Comments

0

I got the answer from How can I hide extra divs with an ellipsis?

.abcd {
    display: block;
    border: 1px solid;
    max-width: 140px;
    padding: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.abcd .abc {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.