admin管理员组文章数量:1332394
I am new to React and wanted to add cursor:pointer on react router Link hover in React. I am using CSS modules and basically did everything right but still pointer does not appear on hover. Here is the code I am using:
<Link className={styles.title} to="/">
<h2>
<i className="fa fa-sun-o "></i>
{title}
</h2>
</Link>
The code in CSS file
.title,
.title:hover,
.title:active,
.title:visited,
.title:focus {
text-decoration: none;
cursor: pointer;
color: blue;
}
I am new to React and wanted to add cursor:pointer on react router Link hover in React. I am using CSS modules and basically did everything right but still pointer does not appear on hover. Here is the code I am using:
<Link className={styles.title} to="/">
<h2>
<i className="fa fa-sun-o "></i>
{title}
</h2>
</Link>
The code in CSS file
.title,
.title:hover,
.title:active,
.title:visited,
.title:focus {
text-decoration: none;
cursor: pointer;
color: blue;
}
Share
Improve this question
asked Sep 20, 2019 at 14:54
DickensDickens
9154 gold badges12 silver badges27 bronze badges
1 Answer
Reset to default 6className
should be applied to Link's children
or a wrapper
. Link
doesn't accept className
prop
<Link to="/">
<h2 className={styles.title}>
<i className="fa fa-sun-o "></i>
{title}
</h2>
</Link>
本文标签: javascriptcursorpointer not working for ltLinkgt in ReactStack Overflow
版权声明:本文标题:javascript - cursor:pointer not working for <Link> in React - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742259873a2442314.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论