14

If I place a body of text into a container with a set height and hidden overflow, I will often end up with the final line that could fit being cut off. Example jsFiddle or image:

enter image description here

Is there a way to have that line not appear entirely rather than have this happen?

The scenario is that I have columns which are a dynamic height (100% of the parent height, which is 80% of the body height) containing blog-post text and I want to display a "read all" at the bottom if there is overflowing text (easy to determine). At the moment it just looks terrible with half rendered text sitting above it.

I can't remove the overflow as the columns need to end before the navigation, which sits at the bottom of the page.

Marty
  • 39,033
  • 19
  • 93
  • 162

5 Answers5

1

You can inspire you from the property text-overflow but you have to do it with JavaScript for multiples lines: http://pvdspek.github.com/jquery.autoellipsis/ (via With CSS, use "..." for overflowed block of multi-lines)

Community
  • 1
  • 1
LeBen
  • 1,884
  • 12
  • 21
1

see this is my code below

 <li style="color: Black; font-weight: bold; oveflow:hidden; line-height: 1.2em;height: 2.6em; ">Page Size
                    <select id="ddlOrderstoDisplay" style="width: 50px;">
                        <option value="25">25</option>
                        <option value="50">50</option>
                        <option value="75">75</option>
                        <option value="100">100</option>
                        <option value="150">150</option>
                    </select>               
                </li>

I Put these lines inside the tag it will work on all browser .Hope it will help for you

**overflow: hidden;
line-height: 1.2em;
height: 3.6em;**  
Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Praveen04
  • 985
  • 10
  • 12
0

You can increase or decrease the line-height

according to your comfort

supersaiyan
  • 1,670
  • 5
  • 16
  • 36
  • How would I dynamically set the appropriate `line-height`? Also, this would probably not look too great from the angle of consistency when there are 5 columns on-screen with different line-heights. – Marty Aug 29 '12 at 10:04
  • i am not getting.. why your are giving diffrent line-height ?? all 5 columns should have same line height – supersaiyan Aug 29 '12 at 10:11
  • Ah true, though that still brings me to the problem of working out what the line-height should be in a dynamic space. – Marty Aug 29 '12 at 23:27
0

Remove overflow:hidden

div
{
    width: 100px;
    height: 92px;
    background: black;
    color: white;
}​
Jitender
  • 7,593
  • 30
  • 104
  • 210
0

just add 'column-width' attribute, it will work. in your example it will column-width:100px

Nauman Sharif
  • 205
  • 2
  • 12