Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Stop auto size of table cells?

Reply
Thread Tools

Stop auto size of table cells?

 
 
harry
Guest
Posts: n/a
 
      05-14-2004
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


 
Reply With Quote
 
 
 
 
Matthias Gutfeldt
Guest
Posts: n/a
 
      05-14-2004
harry wrote:
> 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

 
Reply With Quote
 
 
 
 
harry
Guest
Posts: n/a
 
      05-14-2004
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!


"Matthias Gutfeldt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> harry wrote:
> > 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Shipping Auto Shipping Scheduling:car moving auto transport linkswanted ASP .Net 1 11-22-2013 07:02 AM
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM



Advertisments