• Resolved pnaw10

    (@pnaw10)


    I am trying to use the CSS code mentioned in the FAQ to give different background colors to odd/even rows of my spreadsheet. However, it appears that the HTML code generated by this plugin has an error which prevents the odd/even classes from being used.

    Here’s the code you provided in the FAQ:

    .igsv-table tr.odd  { /* styles for odd-numbered rows   (row 1, 3, 5...) */ }
    .igsv-table tr.even { /* styles for even-numbered rows  (row 2, 4, 6...) */ }

    Added that CSS code to my website (with actual colors within the brackets):

    .igsv-table tr.odd  { background-color:#eeeeee; /* styles for odd-numbered rows */ }
    .igsv-table tr.even { background-color:#dddddd; /* styles for even-numbered rows */ }

    But nothing happened, and here’s why — check the HTML output shown when I use “view source” in my browser:
    <tr id="igsv-(key-redacted)-row-2"class="row-2"even">

    When I view it in the browser inspector, the code looks slightly different, but perhaps much easier to spot the error:
    <tr id="igsv-(key-redacted)-row-2" class="row-2" even"="">

    Long story short, looks like there’s one (or more) too many quotation marks in every single tr tag. The code for the columns is correct:
    class="col-1 odd"
    Notice how the column number AND the odd/even attribute are nested within the same set of quotation marks. By contrast, the row tags have that extra quote, which sets the even/odd attribute outside of the quotes, causing the browser to see both odd=”” or even=”” as independent attributes. If the errant quotation mark could be removed, that would be wonderful.

    (Ideally, it would be great if the plugin could simply carry-in the background colors from the original spreadsheet as it appears in Google Docs, but I digress. The plugin is still very great, and if this one bug could be resolved so I can “zebra-stripe” my rows, I’d be happy enough to donate.)

    • This topic was modified 8 years, 3 months ago by pnaw10.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Meitar

    (@meitar)

    This bug has been fixed in version 0.12.8, please update.

    But also, zebra striping is possible without even or odd (or equivalent) class values because CSS3 allows for the nth-of-type() pseudo-class. In a future version of this plugin, the even and odd class values will be removed, so I suggest you use CSS3 for zebra striping moving forward.

    Thread Starter pnaw10

    (@pnaw10)

    Thank you for the quick response and for updating the plugin. Everything works as expected now!

    Thank you also for the link to the CSS3 information. I just used the older even/odd code since that’s what was in the FAQ… but I will try to get it work with the CSS3 method so it’s OK before you remove the even/odd classes.

    Donation sent your way via PayPal… thanks again for the awesome plugin!

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

The topic ‘HTML Error fouling-up CSS?’ is closed to new replies.