[英]Hover on a styled component without wrapper
So I have this: 所以我有这个:
const Link = styled.a`
color: blue;
`;
<Wrapper>
<Link href="/">Hover Change</Link>
<Wrapper>
I want to put a hover effect on just the Link element to change the color to white. 我只想在Link元素上悬停效果,以将颜色更改为白色。 Any other docs I have seen would have me put a hover call when I call Link: 我看到的任何其他文档都会在我调用Link时进行悬停呼叫:
const Wrapper=styled.div`
&:hover ${Link}: white;
';
<Wrapper>
<Link href="/">Hover Me</Link>
<Wrapper>
How do I place the a:hover in the styling for the Link component? 如何在链接组件的样式中放置a:hover?
@psion have you checked something like the following code: @psion是否检查了类似以下代码的内容:
const Link = styled.a`
color: blue;
&:hover {
color: white;
}
`;
<Link href="/">Hover Change</Link>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.