Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Multiple Table Styles on same page in WordPress

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #241636
    TLJ
    Participant

    I am trying to style multiple tables on the same web page on the salient themed wordpress site. The tables are called via javascript link. I was able to style all the table the same way but want different styles on each table. Any help will be greatly appreciated. Here is the code I use to style the tables:

    http://codepen.io/TLJ/pen/gryyEX

    #241646
    Atelierbram
    Participant

    If you can’t put classes on the tables, maybe you can use the nth-of-type selector to target the different tables in CSS, like:

    :nth-of-type(0n+2) table tr:nth-child(odd) {
      background-color: salmon;
    }
    

    my fork of your demo

    #241693
    TLJ
    Participant

    I am able to make classes but unsure how to link them to any particular table. Can anyone explain?

    #241697
    Atelierbram
    Participant

    I meant in the HTML, set a class-name on the different tables, like doing <table class="table table-purple"> and <table class="table table-yellow"> and so on.
    After that target them in CSS. Like:

    .table-yellow tr:nth-child(odd) {
      background-color: yellow;
    }
    

    Have you access to this, or are you using some kind of plugin with javascript? If you don’t have access to the templates, then go with my last answer.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.