Solved

Using an overflow: hidden; and white-space:nowrap; - WITHOUT it affecting the size of a container

Posted on 2012-03-29
2
292 Views
Last Modified: 2012-04-02
Hello,

I have a web app.  It's a Ruby-on-Rails app - but this is more of a CSS question...


I want it to have a table with collapsible cells that have text in them of various lengths.  If the text is longer than the table cell - either before or after the table cell is collapsed to a specific length - I need the text to be hidden behind the edge of the cell.

I can do this - using a CSS with overflow: hidden; and white-space:nowrap;

Trouble is, the table cell - or whatever I put the text into - doesn't size the same - depending on the size of the text.  Longer text makes the container much wider; shorter text doesn't.

Basically, the collapsible container doesn't act the same when it has overflow:hidden text in it.

Is there any way to force the container to behave the same?

Thanks in advance,
Tim
0
Comment
Question by:tmitch68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 250 total points
ID: 37785557
0
 
LVL 3

Assisted Solution

by:Rameshwar Vyevhare
Rameshwar Vyevhare earned 250 total points
ID: 37786313
try this one.

table
      {
        width:250px;table-layout:fixed;
      }
table tr {
             height:1em;  
             }
td {
     overflow:hidden;white-space:nowrap;  
    }
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Responsive Font Size 6 64
Bootstrap 3 - Style a dropdown 1 32
carousel control extend past the images 9 26
CSS styling problem 3 27
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question