Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Fixed Column Widths

How can I fix the widths of my columns within a table irrespective of the length of text inside.
When I fix a column at 20%, if the text within exceeds 20% the column grows. ( I just want it to cut the text short)
I also don't want to specify 'wrap' on the column because I don't want it to go over 2 lines.

Anyone have a solution

Thanks
0
carlmc
Asked:
carlmc
  • 5
  • 3
  • 2
  • +1
1 Solution
 
brunoCommented:
<table style="table-layout: fixed;">
0
 
COBOLdinosaurCommented:
Bruno gave you part of it, but it can still push out if the text does not have a natural break point like an url. you then need the cell to be like this:

<td style="width:20%;overflow-x:hidden">

Cd&
0
 
brunoCommented:
a good note, i had thought in my experience that just the first part would stop it from being pushed out however, that the content would just be hidden if it went beyond the specified width.

carlmc, using both would be the best way to go i'm sure....



BRUNO
0
Independent Software Vendors: 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!

 
COBOLdinosaurCommented:
You could also use overflow-x:scroll but it is not very reliable, often breaks something else, and screws up hte height of the rows.

Cd&
0
 
carlmcAuthor Commented:
Thanks both of you, You both helped but I had to give the points to Cobol as he was the one who gave me the final solution.

Thanks to both of you
0
 
COBOLdinosaurCommented:
Why only a B?  What else were you looking for?  Don't you think it rather unfair to give an inferior grade without saying why and offer a chance to address whatever you consider to be defective in the solution?

Cd&
0
 
carlmcAuthor Commented:
Apologies CD,

The answer was perfect - I was meant to give you an Excellent Grade - I didn't even know I hadn't

My mistake - I will take more care next time
0
 
brunoCommented:
carlmc,

I'm sure Cd& would appreciate if you took the time to address the problem, as it's EASY to take care of.  Simply post a question in Community Support (link on the left) and tell them you mistakenly gave the wrong grade.  They'll be happy to take care of it for you.



BRUNO
0
 
COBOLdinosaurCommented:
I understand carlmc. Sometimes the form comes up with the B set as default.  They will have it fixed in the re-write.

Thanks for responding.  I just wanted to make sure we hadn't missed anything.

Cd&
0
 
ComTechCommented:
As requested by carlmc, I have change the grade to an A as he requested.

Thanks,
ComTech
CS Admin @ EE
0
 
COBOLdinosaurCommented:
Thanks carlmc, ComTech, and Bruno. :^)

Cd&
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now