how to implement >elemnt selector in aphrodite. I want to style my child div to width "100%"
inputContainer: {
width: '100%',
"> div": {
width: '100%'
}
},
but it is not working.
Its a bit of a hack workaround, but I believe this should work with Aphrodite:
':nth-child(1n) > div': {
width: '100%'
},
It works because Aphrodite basically will transpose anything verbatim into the style tag it creates if you start the rule with a ":".
Use AphroditeJSS instead. It uses the same API as Aphrodite, and handles Aphrodite's some of Aphrodite shortcomings, descendant styling being one of them.
https://github.com/cssinjs/aphrodite-jss
npm i aphrodite-jss --save-dev
const inputCss = Stylesheet.create = ({ inputContainer: { width: '100%', "> div": { width: '100%' } }, });
Aphrodite does not supported nested element styling. I would suggest using styled-components or glamorous.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.