Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6679477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:21:49+00:00 2026-05-26T04:21:49+00:00

I have a bit of php determining the value of a variable, which essentially

  • 0

I have a bit of php determining the value of a variable, which essentially checks to see 0,1, or 2. If it’s 1, it adds a css class to my row.

Sadly i’ve noticed a minor bug that resets this styling if the zebra widget is enabled, and I sort the results. I can’t really style my table with css3 as it messes up when sorted doesn’t it?

Anyone else had this problem, setting !important; on my custom CSS classes doesn’t work

Should I include my CSS classes with !important; very last or something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:21:50+00:00Added an answer on May 26, 2026 at 4:21 am

    The best answer would be to drop the Javascript solution to this, because pure CSS can do zebra striping just fine, using the :nth-child() selector:

    tr:nth-child(odd) {
      background-color: #FFFFFF;
    }
    
    tr:nth-child(even) {
      background-color: #CCCCCC;
    }
    

    With the above, you have no need to add 1 and 2 classes to your table rows, and the browser will automatically pick up the correct rows to style when the table is sorted, without you having to do anything else. It works without needing any javascript code at all.

    The obvious big caveat to this is that nth-child() isn’t supported by IE8 and earlier.

    For this, you do need a Javascript solution, but I’d suggest using one which helps IE to recognise this selector, rather than a javascript solution that does the whole thing.

    There are two JS solutions for IE which help give it support for additional CSS selectors:

    • Selectivizr
    • Dean Edwards’ IE7.js

    Either of these will allow IE to use the above CSS code. Selectivzr is more modern and more focussed on CSS selectors. IE7.js is an older script which tries to do a lot more. I’d suggest using Selectivzr as a first choice because it’s known to work well with jQuery, but you may be tempted by some of the other stuff the IE7.js does, so it may be worth giving it a try.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of PHP code which I need to return an even
I'm fairly new to HTML, PHP, CSS and Javascript. I do have a bit
I have a bit of code which alerts the $response from a php code
I know a bit of PHP and so also HTML/CSS, and I have made
I have the following bit of PHP code, which creates three database tables, then
I have a bit of php code like this: $test = <!--my comment goes
How can I have a 64-bit integer in PHP? It seems like it is
I have the following arrays in PHP (okay they are a bit bigger but
I currently have a news website setup in PHP/MYSQL that's a bit old and
its a little bit hard to understand. in the header.php i have this code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.