Search code examples
htmlcsslimitdepth

CSS style does not apply, style depth limit?


I have the following problem:

I get a generated HTML with dynamic content. The IDs and the html tag-hierarchy is always the same. I can set a stylesheet.

I tried to set the color of the text to red. If I set it on this position where it's done in the screenshot it does not work. If I set it inline in the table below (table cols=2 border=0...) it works.

Code snipset

Is there a depth limit for CSS ? How can I set the color for the whole text containing the div (id=15B_gr or id=oReportCell) ?


++UPDATE++

I tried to set a stylesheet, but it does not work: Code snipset 2 Css part 1 Css part 2


Solution

  • You should be able to target all the children of a div by using an asterisk. In this case:

    #15B_gr * {
        color:red;
    }
    

    or you could set it on just the elements:

    #15B_gr span {
        color:red;
    }
    

    ** Edit for further information **

    As pointed out by @nico o, some complications can arise due to having a number as the first character in the ID. Previous versions of the HTML spec did not allow IDs to begin with a number.

    http://w3c.github.io/html-reference/datatypes.html#common.data.id