[ACCEPTED]-Why doesn't table > tr > td work when using the child selector?-css-selectors

Accepted answer
Score: 87

In HTML, browsers implicitly add a tbody element 10 within which to contain the tr elements1, so 9 in reality, tr is never a child of table.

Consequently, you 8 have to do this instead:

table > tbody > tr > td

Of course, if you 7 add a tbody element yourself, you use the same 6 selector. The spec explains when a tbody is added 5 implicitly otherwise:

Tag omission

A tbody element's start 4 tag may be omitted if the first thing inside 3 the tbody element is a tr element, and if the element 2 is not immediately preceded by a tbody thead, or tfoot element 1 whose end tag has been omitted.


1 This is not the case for XHTML documents that are properly served as application/xhtml+xml, however, given its XML roots.

Score: 2

If you want to be more catholic than the 12 pope :) here is what I did (because none 11 of the above worked for me):

1) Create a 10 css class, assign it to the property of 9 the GridView (eg:

<PagerStyle CssClass="pagerNoBorder" /> 

)

2) Define you css class 8 just as the page numbers are rendered by 7 your browser (inspect the element in the 6 browser and look for all the child selectors!). In 5 my case, this was the situation:

.pagerNoBorder > td > table > tbody > tr > td
    {
        border-width:0px !important;
        border-style:none;
    }

If you're 4 going to say why border-width (+ !important) and 3 border-style in the same time then read 2 again the intro of my answer :) . Cheers 1 and good day!

More Related questions