Solved

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

Posted on 2012-03-29
2
298 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Suggested Courses

623 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