quick css questions
Hey, i just a few quick questions
1) is there a way to select an element based off of whether it's a certain count of one on the page? I know
nth-child
and nth-of-type
do this, but only if the elements are siblings. If i wanted to select the 3rd p element on the whole page for example, would that be possible? maybe it's with that of
selector that's floating around?
2) I've noticed that if you have a list inside of another list, the child's ul/ol
element will have it's user agent margin removed, what causes this? is it because of the way sub-lists work? https://codepen.io/deerCabin/pen/wvVRoVG
Thanks in advance.12 Replies
1- no, not without javascript
2- pure css
it has a simple
ul ul
selector to remove the margins
thats itthat's what i was thinking, but i thought there was a css for some reason haha
oh that makes sense, where can i see the whole user agent stylesheet to find these styles? i know you can see snippets in the dev tools but is there a whole css file or something?
probably in the source code of the browser
https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/core/html/resources/html.css <-- this is for chrome
ah that's super useful, thank you
you're welcome
if you search for
ul ul
, you will see the style that removes the marginsah yeah i see now
everything you see, by default, is in there
Yeah that’s quite useful, are there other GitHub repos with other browser ones in?
probably firefox
yeah i think that might be the only other
though it's not on github, it's hosted here https://hg.mozilla.org/mozilla-central
mozilla-central summary
A summary of repository state for mozilla-central
many projects that use a different source control service have a mirror on github