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 8398683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:06:44+00:00 2026-06-09T21:06:44+00:00

I want to wrap a text within only two lines inside div of specific

  • 0

I want to wrap a text within only two lines inside div of specific width. If text goes beyond the length of two lines then I want to show ellipses.
Is there a way to do that using CSS?

e.g.

Sample text showing wrapping
of text in only two line...
  • 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-09T21:06:46+00:00Added an answer on June 9, 2026 at 9:06 pm

    Limiting output to two lines of text is possible with CSS, if you set the line-height and height of the element, and set overflow:hidden;:

    #someDiv {
        line-height: 1.5em;
        height: 3em;       /* height is 2x line-height, so two lines will display */
        overflow: hidden;  /* prevents extra lines from being visible */
    }
    

    — jsFiddle DEMO —

    Alternatively, you can use the CSS text-overflow and white-space properties to add ellipses, but this only appears to work for a single line.

    #someDiv {
        line-height: 1.5em;
        height: 3em;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 100%;
    }
    

    And a demo:

    — jsFiddle DEMO —

    Achieving both multiple lines of text and ellipses appears to be the realm of javascript.

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

Sidebar

Related Questions

I want to display some div's in a wrap. The div have same class
I am looking for the best method to find specific text within a file
I want to wrap text of the cells in the UITableView. I am using
I want to achieve wrap text in android. I am using following attributes but
Is it possible to wrap text around a non rectangular image? I want text
I have a system similar to BB code whereby text within two tags is
I want to find all TEXT or HREF matching a RegExp within an HMTL
Is there an easy way to wrap spans around arbitrary text within an html
I want to wrap around a list/vector in C++ like in Python. Basically I
I want to wrap some queries in a SharedDbConnectionScope and execute them under a

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.