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 6917777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:46:24+00:00 2026-05-27T09:46:24+00:00

How can I select the nth-element of a X class using only CSS 3

  • 0

How can I select the nth-element of a X class using only CSS 3 selectors? Specifically, i need to select each even table row in a table to apply a style, but sometimes i insert a table row that needs to be ignored because it isn’t data.

I tried using

tr.X:nth-child(even)
.X::nth-child(even)

and i know that :nth-of-type() exists but neither of those seems to fulfill my requirements.

Is it possible to achieve this with pure CSS3 ? If not i don’t really mind, but i’ll be glad to hear your ideas.

HTML table

<table class="txls">
    <thead class="centro">
        <tr class="bg-gris">
            <td class="txlsb" rowspan="2" width="14">&nbsp;</td>
            <td class="txlsb" rowspan="2">Linea</td>
            <td class="txlsb" colspan="7">Kilometros</td>
        </tr>
        <tr class="bg-gris">
            <td class="txlsb" width="100">Atenci&oacute;n</td>
            <td class="txlsb" width="100">Derecho de via</td>
            <td class="txlsb" width="100">Administrativos</td>
            <td class="txlsb" width="100">Contencioso</td>
            <td class="txlsb" width="100">Expropiados</td>
            <td class="txlsb" width="100">Construccion</td>
            <td class="txlsb" width="100">Regularizados</td>
        </tr>
    </thead>
    <tbody>
        <tr class="X">
            <td class="txlsb"><img src="imgs/collapse-medium-green.png" /></td>
            <td class="txlsb">XXX-45820-YYY</td>
            <td class="txlsb">12.50</td>
            <td class="txlsb">60.12</td>
            <td class="txlsb">8.00</td>
            <td class="txlsb">10.00</td>
            <td class="txlsb">0.00</td>
            <td class="txlsb">0.00</td>
            <td class="txlsb">18.00</td>
        </tr>
        <tr >
            <td class="txlsb bg-cancel">&nbsp;</td>
            <td class="txlsc" colspan="8">
                <table class="txls w100">
                    <thead>
                        <tr class="bg-verde2">
                            <td class="txlsb" width="14"><img src="imgs/collapse-medium-green.png" /></td>
                            <td class="txlsb">Zona Foo</td>
                            <td class="txlsb" width="100">3.00</td>
                            <td class="txlsb" width="100">1.00</td>
                            <td class="txlsb" width="100">0.00</td>
                            <td class="txlsb" width="100">0.00</td>
                            <td class="txlsb" width="98">4.00</td>
                        </tr>
                    </thead>
                    <tbody class="">
                        <tr>
                            <td class="txlsb bg-cancel">&nbsp;</td>
                            <td class="txlsc" colspan="6">
                                <table class="txls w100">
                                    <thead class="centro">
                                        <tr class="bg-gris2">
                                            <td class="txlsb"  width="100">Tramite</td>
                                            <td class="txlsb">Num. Caso</td>
                                            <td class="txlsb">Expediente</td>
                                            <td class="txlsb">Predio</td>
                                            <td class="txlsb" width="55">T. Inicial</td>
                                            <td class="txlsb" width="55">T. Final</td>
                                            <td class="txlsb bg-cancel" width="96">&nbsp;</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr class="X">
                                            <td class="txlsb">Administrativo</td>
                                            <td class="txlsb">12</td>
                                            <td class="txlsb">YC-AGR-12390-2011</td>
                                            <td class="txlsb">la chuchita</td>
                                            <td class="txlsb">12.1</td>
                                            <td class="txlsb">25.0</td>
                                            <td class="txlsb">3.00</td>
                                        </td>
                                        <tr class="X">
                                            <td class="txlsb">Contencioso</td>
                                            <td class="txlsb">13</td>
                                            <td class="txlsb">YC-AGR-52323-2011</td>
                                            <td class="txlsb">el almendro</td>
                                            <td class="txlsb">50.0</td>
                                            <td class="txlsb">51.0</td>
                                            <td class="txlsb">1.00</td>
                                        </td>
                                    </tbody>
                                </table>
                            </td>
                        </td>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr class="X">
            <td class="txlsb"><img src="imgs/expand-medium-green.png" /></td>
            <td class="txlsb">AAA-83010-BBB</td>
            <td class="txlsb">50.92</td>
            <td class="txlsb">92.45</td>
            <td class="txlsb">10.08</td>
            <td class="txlsb">0.00</td>
            <td class="txlsb">0.00</td>
            <td class="txlsb">0.00</td>
            <td class="txlsb">0.00</td>
        </tr>
    </tbody>
</table>
  • 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-27T09:46:25+00:00Added an answer on May 27, 2026 at 9:46 am

    The CSS4 specifications call for the :nth-match() pseudo-selectors, but at the present time there is not one available for use. All the current pseudo-selectors are in the context of all elements that it can look at in the current branch. The nth-child(even) is only being applied to the tr and not the .X.

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

Sidebar

Related Questions

How can I select the Nth row from a table in Oracle? I tried
I can select the first item in the div using $('.class:first') Now since I
Possible Duplicate: How to select the nth row in a SQL database table? I
I'm using MySQL v5.0.45 and trying to delete the nth row in a table
How can I select nth < td > of a < tr > using
I have GridView which I can select a row. I then have a button
I have a simple table of data, and I'd like to select the row
how can i select the nth child in a set of <div> 's when
With jQuery selectors you can select a div that contains the innerText John with
I have a page where the user can select three different appointment days using

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.