'Can you use :nth-of-type without a selector and get the same functionality as :first-child? [duplicate]
Trying to address a console warning I'm getting from MUI5/emotion (I think)
The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type".
So I was curious, what happens if you omit the selector in :first-of-type? I don't see any difference when I do this. Maybe it's ok?
EDIT: ^ This is my question and it is not answered in the question that is being linked too. I only included the emotion bit for context.
Solution 1:[1]
Maybe it has something to do with browser compatibility. The pseudo class :first-of-type https://developer.mozilla.org/de/docs/Web/CSS/:first-of-type is understood by all browsers. Whereas :first-child is not supported by some. https://developer.mozilla.org/de/docs/Web/CSS/:first-child
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
