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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:20:05+00:00 2026-05-31T13:20:05+00:00

Is there any JS/CSS/jQuery magic I can work to identify whether the last visible

  • 0

Is there any JS/CSS/jQuery magic I can work to identify whether the last visible bit of content in a div is being cut off, and slightly increase/decrease the DIV’s height to prevent the cut off text?

Our system allows the user to enter “elements” containing XHTML (using a Telerik Edit control). We have an ElementList page, where we show all the user-entered elements. However, since the user-entered XHTML can be very large, on the list page we only want to show the first 3 lines of each. So I set the DIV containing the XHTML to a specific height equal to 3 rows of text, and set overflow: hidden. So far, so good.

However, since the user can enter XHTML, they can create tables with padding (or otherwise diverge from standard text height). The text within those cells appears to be sliced off horizontally, due to the combination of height and overflow: hidden. Our requirements person doesn’t like the look of this; but of course we cannot restrict the XHTML editable by the end user.

Here is a JSFiddle example of the issue.

This question is not a duplicate of:

  • “Stopping cut off text in variable height div…” as that question involves “webkit-line-clamp” which is irrelevant to my situation. (and in any case, that question was never answered)
  • “Cut text by height, no truncate” as that question is about a DIV containing pure text; my DIV contains XHTML. You’ll note in the JSFiddle that I’m already sizing the DIV height using the em measurement.

This issue has me completely baffled – I’m hoping the SO community can come to my rescue!

UPDATE:

Ultimately, I suspect this cannot be resolved using HTML/JS/jQuery. In fact, you can craft a table (or series of DIVs) with gradually increasing top-margins, such that there’s no way to avoid slicing at least one of them.

Thanks to all for their responses. I’m marking one as an answer, because in my opinion, it’s a particularly simple/elegant workaround.

  • 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-05-31T13:20:06+00:00Added an answer on May 31, 2026 at 1:20 pm

    This is not the solution you were looking for, but it might be a good design workaround.
    I put a white gradient in the bottom of the div, so that it creates sort of a “visual ellipsis”

    Take a look: http://jsfiddle.net/robertofrega/LkYjs/3/

    It is not as ugly as when the text is simply cut.

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

Sidebar

Related Questions

Is there any syntactical way in jQuery to define multiple CSS attributes without stringing
Is there any way to theme an HTML table (CSS) with using the jQuery
When using selectors in CSS and in jQuery, are there any efficiency differences between
jQuery is cross browser, so it abstract JavaScript. Is there any library for CSS
is there any way to use custom border by css or can make by
Is there any css/layout way we can have equal height columns via 960.gs right
height: 100% in CSS obviously doesn't work. So is there any other CSS or
Is there any way to set a href link color using the jquery css
Are there any good CSS coding style/standards?
Are there any html/css checkers that are javascript based like JSLINT?

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.