Pseudo elements ::before and ::after don't work when using object syntax
See original GitHub issueEnvironment
System:
- OS: macOS 10.14
- CPU: (4) x64 Intel® Core™ i5-7360U CPU @ 2.30GHz
- Memory: 69.29 MB / 8.00 GB
- Shell: 5.3 - /bin/zsh
Binaries:
- Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
- Yarn: 1.9.4 - /usr/local/bin/yarn
- npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
- Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
- styled-components: ^4.0.3 => 4.0.3
Steps to reproduce
Create a styled component in object syntax with a pseudo selector. ie:
const StyledDiv = styled.div({
'::before': {
content: '🚀'
}
})
Expected Behavior
We should see a pseudo element inside the div.
Actual Behavior
A pseudo element doesn’t get added to the div
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
before - CSS: Cascading Style Sheets - MDN Web Docs
In CSS, ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content...
Read more >::before / ::after | CSS-Tricks - CSS-Tricks
The ::before and ::after pseudo-elements in CSS allows you to insert content onto a page without it needing to be in the HTML....
Read more >[Fixed] CSS :after element is not working - Weekend Projects
A few ways to fix why :after element is not working. 1. We need to check if we are using the right HTML...
Read more >Diving into the ::before and ::after Pseudo-Elements
In CSS, ::before and ::after are keywords you can add to a selector to create pseudo-elements. The pseudo-elements are inserted into the element ......
Read more >CSS pseudo-elements a Ridiculously Simple Explanation
Did you notice the use of the content property, with the ::before and ::after pseudo-elements? Objects that are inserted using the content ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does actually work, there’s just a nuance around how the
content
property needs to be set: https://codesandbox.io/s/lxm7q494kzTLDR — wrap value with extra quotes:
BAD:
GOOD: