• Resolved esbfi

    (@esbfi)


    I have an ongoing interview series on my blog. It will run on my blog for years, and will likely accrue to at least 20 posts before the end of the year (with perhaps 12 per year after that).

    Problem is, each post includes 6 tables. And I need to add the exact same custom CSS styling to each of those tables. 6 tables x 20+ posts in year one, then 12 posts per year after that is a lot of tables and a lot of CSS code!

    Below, you can see the styling I’ve added for the first four interviews:

    .tablepress-id-14 .column-1,
    .tablepress-id-15 .column-1,
    .tablepress-id-16 .column-1,
    .tablepress-id-17 .column-1,
    .tablepress-id-18 .column-1,
    .tablepress-id-19 .column-1,
    .tablepress-id-20 .column-1,
    .tablepress-id-21 .column-1,
    .tablepress-id-22 .column-1,
    .tablepress-id-23 .column-1,
    .tablepress-id-24 .column-1,
    .tablepress-id-25 .column-1,
    .tablepress-id-26 .column-1,
    .tablepress-id-27 .column-1,
    .tablepress-id-28 .column-1,
    .tablepress-id-29 .column-1,
    .tablepress-id-30 .column-1,
    .tablepress-id-31 .column-1,
    .tablepress-id-32 .column-1,
    .tablepress-id-33 .column-1,
    .tablepress-id-34 .column-1,
    .tablepress-id-35 .column-1,
    .tablepress-id-36 .column-1,
    .tablepress-id-37 .column-1,
    .tablepress-id-38 .column-1 {
    width: 35%;
    }

    That’s a lot of CSS, and I’m only about 20% of the way through my interviews just for this year! My question: is there a way to minimize this by only needing to mention the table id # and not the entire line for every single table?

    Apologies if this is a dumb request. I am not a programmer, so I only have very basic knowledge of CSS! Thanks in advance for your help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Unfortunately, shortening this so that only the table ID is needed is not possible, due to how CSS code works.
    However, you could maybe use a slightly different approach:
    https://wordpress.org/support/topic/creating-a-class-for-multiple-tables/#post-12569808

    With this, you would essentially define a “template styling” for your tables with CSS code once. Then, you would “assign” that template to a table by giving the table the “Extra CSS class” that you used in the template CSS code.

    Regards,
    Tobias

    Thread Starter esbfi

    (@esbfi)

    Hello TobiasBG,

    Sorry for my late reply. I knew I’d need some focused time to figure this out, and I only had time to get to it now!

    I went through the thread that you shared, as well as the numerous threads that you linked to from that thread and the ones prior. They were all very helpful!

    I figured it out, and now have very happily added the Extra CSS class to all the tables in my series (and was able to delete the very long list of custom CSS that listed each table). THANK YOU for the amazing support and wonderful plugin!

    Chrissy

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

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

The topic ‘Minimizing CSS’ is closed to new replies.