Solution 1 :

#divQuestions selector works for me if I fix the div’s closing tag (or even if I don’t, as it turns out):

<html>
  <html>
    <html>
      <html>
        <div id="divQuestions"> </div>
      </html>
    </html>
  </html>
  <style id="stylish-23" type="text/css">
    #divQuestions {
      padding: 48px;
      background: aliceblue;
      border: 4px solid blue;
    }
  </style>
</html>

Solution 2 :

nth-of-type is a selector that matches the nth element of their “type”.
So, you can do this:

html:nth-of-type(1)
html:nth-of-type(2)
html:nth-of-type(3)
...

Or, you can do this since you said “multiple nested tags”:

html
html > html
html > html > html
...

Problem :

I’m working on making a dark mode for the Kaplan website tests so I don’t blind myself studying.

The following HTML code is representative of the structure of the source, and the tag with id=”stylish-23″ is what’s added by a chrome extension to change the page’s CSS styling:

<html> // html 1
  <html> // html 2
    <html> // html 3
      <html> // html 4
        <div id="divQuestions"> </div> //actual tag I want to change
      </html> // html 4
    </html> // html 3
  </html> // html 2
  <style id="stylish-23" type="text/css">...</style>
</html> // html 1

I put div#divQuestions in the style tag’s CSS and it does not appear to have any effect at all. Due to the nature and limitation of the extension, I’m only able to add CSS to the style tag, and the CSS appears to not be able to select HTML tags (or at least when I do, nothing happens). I’ve noticed that dragging the style tag into html #4 in developer console will properly apply the CSS.

The element in question’s CSS from inspect:
The element in question's CSS from inspect

My CSS in the style tag:

div#divQuestions {
  background: black;
}

Thanks for the help!

Comments

Comment posted by ray

Why are there 4 html tags?

Comment posted by Conanap

@rayhatfield no idea, I didn’t write this code. Just tryna not kill my eyes

Comment posted by ray

You’re missing a

Comment posted by Conanap

that was a typo on my end for posting the question, sorry. Thanks for catchign that

Comment posted by ray

Could be another more specific css selector somewhere that’s taking precedence over yours? Can you inspect it in the dev tools and see if your rules are being overridden?

Comment posted by Conanap

apologies, that was a typo. Not sure why it doesn’t work on my end then…

Comment posted by Conanap

Ill give this a try too; I’ve tried html html html div#Question but that didn’t work either

Comment posted by Conanap

unfortunately this didn’t work for me either, but thank you for the suggestion

By

Leave a Reply

Your email address will not be published. Required fields are marked *