Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

821 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