Stop auto size of table cells?

H

harry

Is there anyway to prevent a table cell from expanding to fit all the data
in it? i.e the datas 50 char's long but I only want to display the 1st 10
chars?

thanks

harry
 
M

Matthias Gutfeldt

harry said:
Is there anyway to prevent a table cell from expanding to fit all the data
in it? i.e the datas 50 char's long but I only want to display the 1st 10
chars?

I couldn't get it to work with the td directly, probably because the
table has ideas of its own about its width. But wrapping the content in
a suitable container should work, e.g

p {width:5em; overflow:hidden}

And in CSS there's no unit for the width of a character. But 5em should
be close enough, just adjust the value until you're happy with it.

See <http://www.w3.org/TR/CSS2/visufx.html#propdef-overflow> for other
overflow values.


Matthias
 
H

harry

Thanks Matt, found this also style="table-layout:fixed;" which displays as
many as possible but chops off the remaining - just what I wanted!

cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top