相关疑难解决方法(0)

与样式组件一起使用的伪类之前和之后

将样式:before:after伪类应用于样式化组件的正确方法是什么?

我知道你可以使用

&:hover {}

:hover伪类应用于样式化组件.

这是否适用于之前和之后的所有伪元素?

我已经尝试使用&:before&:after策略一些相当复杂的例子,我不确定我的尝试是否工作,因为我的例子有问题,或者它不能像那样工作.

有人对此有一些了解吗?谢谢.

pseudo-class reactjs styled-components

23
推荐指数
3
解决办法
2万
查看次数

如何将 React.Component 放入 CSS 内容属性(在 :before/:after 伪元素中)?

在 中styled-components,我试图通过传递 React Icon 来在悬停时渲染它,content但由于某种原因,我的悬停渲染是[Object Object]

\n

成分:

\n
export const FooLink = styled(Link)`\n  padding: 0.5rem 2rem;\n  color: ${({ theme }) => theme.colors.white};\n  text-align: center;\n  margin: 0 auto;\n  position: relative;\n  font-size: ${({ theme }) => theme.fontSizes.p};\n  letter-spacing: 0.15em;\n  transition: ${({ theme }) => theme.animations.trans3};\n\n  &:after {\n    content: \'${FaArrowRight}\';\n    /* content: \'>\'; */\n    position: absolute;\n    opacity: 0;\n    right: -${({ theme }) => theme.spacings.small};\n    transition: ${({ theme }) => theme.animations.trans3};\n  }\n\n  &:hover {\n    padding-right: ${({ theme …
Run Code Online (Sandbox Code Playgroud)

javascript css reactjs styled-components react-component

6
推荐指数
1
解决办法
1万
查看次数