Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed table column width. How? #863

Closed
viruthagiri opened this issue Dec 28, 2011 · 13 comments
Closed

fixed table column width. How? #863

viruthagiri opened this issue Dec 28, 2011 · 13 comments

Comments

@viruthagiri
Copy link

Can anyone tell me how to give fixed table column width.
I have five columns. I want like 30%,20%,10%,30%,10% Can anyone help me? Thanks

@jasny
Copy link
Contributor

jasny commented Dec 29, 2011

<style>
 table { table-layout: fixed; }
 table th, table td { overflow: hidden; }
</style>

<table class="span12">
  <thead>
    <tr>
      <th style="width: 30%">Col 1</th>
      <th style="width: 20%">Col 2</th>
      <th style="width: 10%">Col 3</th>
      <th style="width: 30%">Col 4</th>
      <th style="width: 10%">Col 5</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Val 1</th>
      <td>Val 2</th>
      <td>Val 3</th>
      <td>Val 4</th>
      <td>Val 5</th>
    </tr>
  </tbody>
</table>

@viruthagiri
Copy link
Author

@jasny Thanks.. Its working. But i still have problem. Its not working when i have lengthy text in the cell. Is there a way to hide the overflow text?.I tried overflow:hidden; But its not working.

@viruthagiri
Copy link
Author

@jasny Thanks once again. I added style="table-layout: fixed;" and applied overflow:hidden; in the td. Now its working. :)
Thanks

@jasny
Copy link
Contributor

jasny commented Dec 29, 2011

@viruthagiri I've changed the example. Have a look.

@fat This isn't really an issue, please close it.

@viruthagiri
Copy link
Author

Thanks

@fat
Copy link
Member

fat commented Jan 2, 2012

thanks for the help @jasny!

@enlare
Copy link

enlare commented Jan 21, 2013

@jasny thanks!

@canfas
Copy link

canfas commented Mar 7, 2013

Finally found an answer!! Thanks !!

@moonstruck
Copy link

Thanks

@suyashtripathi
Copy link

Thanks @jasny ! Was looking out for this answer for quite a while.

@mostlyharmless2024
Copy link

Same here, thanks @jasny. I spent 15 minutes digging through BS determined to find a helper class that did this... guess i'll make my own haha.

@sgsheg
Copy link

sgsheg commented Mar 12, 2014

Thanks

@natuanorg
Copy link

thanks !

@twbs twbs locked and limited conversation to collaborators Jul 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants