Title: Automatic column width CSS code?
Last modified: September 17, 2020

---

# Automatic column width CSS code?

 *  Resolved [jmceisam](https://wordpress.org/support/users/jmceisam/)
 * (@jmceisam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/)
 * Hi there,
 * Thank you for your amazing plug-in.
 * I have troubles in table display, to resolve it I would need the css code to 
   make 3 colums of 33% width but I can’t find out how to write the right code. 
   Could you help please?
 * By the way, I would like to custom the colours. How to:
    – Header line: Font 
   in white, background in #63bdec – rows: no need to change – hover on rows: font
   in white, background in #5f428d, links in white
 * Many thanks in advance

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13420510)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Please see the TablePress FAQ page at [https://tablepress.org/faq/](https://tablepress.org/faq/)
   for suggestions on the CSS code for column width and colors.
 * Regards,
    Tobias
 *  Thread Starter [jmceisam](https://wordpress.org/support/users/jmceisam/)
 * (@jmceisam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13422693)
 * Great, thanks for all, all work fine! Sorry I didn’t check out the FAQ before.
 * One more question: I have a tree columns table (name, infos, team), and I just
   want two of them to be sorted (name and team), how can I do to avoid one column
   to be sorted (the info column)?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13422776)
 * Hi,
 * good to hear that this helped!
 * Turning off sorting for that column is possible by adding this to the “Custom
   Commands” text field on the “Edit” screen of the table:
 *     ```
       "columnDefs": [ { "ordering": false, "targets": [ 1 ] } ]
       ```
   
 * This will turn off sorting for the second column (counting the columns starts
   with 0).
 * Regards,
    Tobias
 *  Thread Starter [jmceisam](https://wordpress.org/support/users/jmceisam/)
 * (@jmceisam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13422818)
 * Sorry to anoy you again, I do not see where this Custom Commands text filed is
   as it is in French for me, is that the text field under “Javascript DataTables
   library content” ?
 * And then, relating to this post : [https://wordpress.org/support/topic/multiple-custom-commands/](https://wordpress.org/support/topic/multiple-custom-commands/)
   
   If I want to have the first column to be sorted by default in ascending, what
   should I write?
 * Sorry if I have too much help 🙁 I wasn’t supposed to create this…
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13422830)
 * Hi,
 * yes, it’s the text field in the “Javascript DataTables library content” section.
 * To have the first column sorted automatically, please extend the command like
   this:
 *     ```
       "columnDefs": [ { "ordering": false, "targets": [ 1 ] } ], "order": [ [ 0, "asc" ] ]
       ```
   
 * Regards,
    Tobias
 *  Thread Starter [jmceisam](https://wordpress.org/support/users/jmceisam/)
 * (@jmceisam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13422899)
 * Spectacular!
 * The false ordering command doesn’t work, but the ascending does.
 * Don’t worry about the false ordering, you helped me so much at this point.
 * Last question: is that possible to change the background color of the first cell
   of the selected column?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13423043)
 * Hi,
 * Can you please post a link to the page with the table where this problem happens,
   so that I can take a direct look? Thanks!
 * As for the colors: Please see the second part of code from [https://tablepress.org/faq/change-background-color-table-head-row/](https://tablepress.org/faq/change-background-color-table-head-row/)
 * Regards,
    Tobias
 *  Thread Starter [jmceisam](https://wordpress.org/support/users/jmceisam/)
 * (@jmceisam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13423113)
 * Hi,
 * Thank you very much, again. The hover color when sorting CSS code is working 
   absolutly fine.
    At this time, the fact that the second column sorting is not
   turned off is not a problem, but more like an attention to detail. The website
   is not public yet, but I will notice you it will be.
 * Thank you again! I’ll let you know 🙂
 * Have a good day and take care,
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13423676)
 * Hi,
 * ah, I made a small mistake.
 *     ```
       "ordering": false
       ```
   
 * should be
 *     ```
       "orderable": false
       ```
   
 * Can you please try again with that?
 * Regards,
    Tobias
 *  Thread Starter [jmceisam](https://wordpress.org/support/users/jmceisam/)
 * (@jmceisam)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13431551)
 * Yes ! It works !
 * Thanks a lot Tobias !!!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13431698)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   here in the plugin directory. Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Automatic column width CSS code?’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [width](https://wordpress.org/support/topic-tag/width/)

 * 11 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/automatic-column-width-css-code/#post-13431698)
 * Status: resolved