Styling with Emotion in React gives :nth-child is potentially unsafe when doing server-side rendering error
When SSR renders the components, it also renders style elements along with it. The first child of the component may be a style element and using n-th-child
could potentially be unsafe as it would be unintended behaviour.
EmotionJS GitHub Issue
Why is nth-child selector not working?
The nth-child
selector counts siblings (i.e., elements having the same parent).
In your HTML structure, div.social-logo
is always the first, last and only child of a
. So nth-child
has only one element to count.
However, there are multiple anchor elements, all of which are siblings (children of #social-links
), so nth-child
can target each one.
#social-links a:nth-child(1) div
#social-links a:nth-child(2) div
#social-links a:nth-child(3) div
.
.
.
Related Topics
Special Characters in CSS Selectors
Enforce Print Page Breaks with CSS
How to Connect a CSS Animation's End to the Beginning So It Smoothly Continues
Css3 Filter: Drop-Shadow Spread Property Alternatives
8-Digit Hex Is Not a Background-Color Value
How to Get the Same Object with a Class in SCSS
How to Make Bevel and Embosed Effect to Button in CSS 3 for Web-Kit Based Browsers
Compass: Generate Sprites, Plus Width/Height on Each Images in the Sprite
Table Cells Height Calculated Differenly in Ie11
CSS Drop-Down Menus Pushing Page Content Down
Vertically Center HTML Element Within a Div of Dynamic Height
CSS Element Child VS Child with Text Node
How to Route to CSS/Js Files in MVC.Net
Right Border of the Addthis Counter Missing with Twitter's Bootstrap 3
Hover Property in CSS Doesn't Work When I Have an Inline Styles