如何使用更高特异性的样式覆盖样式 - 样式的组件
我阅读了样式的组件文档,并了解了如何超越某些样式的基础知识,但是在我的情况下我无法弄清楚这一点。
我需要覆盖DIV中的某些类,
因此我的结构看起来像这样:
如何从样式组件的更特异性中实现这一目标,而不是!
export const SomeDiv = styled.div`
.someClassName {
left: ${(props) => props.left || 0} !important;
${(props) =>
props.top &&
`
top ${props.top} !important;
`}
}
`
I read styled components docs and know the basics how to override some styles, but I can't figure out this in my case.
I need to override some class in my div
So my structure looks like this:
How Can I achieve this with higher specificity from styled components instead !important
export const SomeDiv = styled.div`
.someClassName {
left: ${(props) => props.left || 0} !important;
${(props) =>
props.top &&
`
top ${props.top} !important;
`}
}
`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
github问题
Github issue