5
 .whysolong {
    overflow-x: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

Put in div

<div class="whysolong">So many people here but only 3 or four global apps grow UP?</div>

OK!

So many people here....

and span

<span class="whysolong">So many people here but only 3 or four global apps grow UP?</span>

Still showing full text..

So many people here but only 3 or four global apps grow UP?

Why?

3
  • Why what? Your whole question is unclear. Commented Dec 13, 2016 at 16:59
  • @curt please scroll down before add a comment. Commented Dec 13, 2016 at 17:05
  • 1
    answers aren't displayed during the review of questions in triage. Commented Dec 13, 2016 at 17:10

4 Answers 4

6

Text overflow can only happen on block or inline-block level elements, because the element needs to have a width in order to be overflow-ed. The overflow happens in the direction as determined by the direction property or related attributes.

 .whysolong {
  overflow-x: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 154px;
}

 .whysolongblock {
  overflow-x: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 154px;
  display: block;
}
<div class="whysolong">So many people here but only 3 or four global apps grow UP?</div>
<span class="whysolong">So many people here but only 3 or four global apps grow UP?</span>
<div class="whysolongblock">So many people here but only 3 or four global apps grow UP?</div>
<span class="whysolongblock">So many people here but only 3 or four global apps grow UP?</span>

Note: text-overflow only occurs when the container's overflow property has the value hidden, scroll or auto and white-space: nowrap;.

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

1 Comment

I just set width and display:inline-block thanks!
1

Property text-overflow applies to block container elements only. A <span> element is inline element by default, therefore it doesn't support this attribute. To make <span> support text-overflow you need to define it as block-level element:

span {
    display: block;
    text-overflow: ellipsis;

}

Comments

0

span has to have either block or inline-block display because otherwise it's just an inline element.

Comments

0

Exists a differences between DIV and SPAN because one is a Block Element and other is a Inline Element.

You can see: What is the difference between HTML tags <div> and <span>?

http://cssreset.com/understanding-the-difference-between-div-and-span/

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.