我有以下几点:
如何去掉蓝色下划线? 代码如下:
<Link to="first"><MenuItem style={{paddingLeft: 13, textDecoration: 'none'}}> Team 1 </MenuItem></Link>
MenuItem组件来自http://www.material-ui.com/#/components/menu
我有以下几点:
如何去掉蓝色下划线? 代码如下:
<Link to="first"><MenuItem style={{paddingLeft: 13, textDecoration: 'none'}}> Team 1 </MenuItem></Link>
MenuItem组件来自http://www.material-ui.com/#/components/menu
当前回答
你可以在Link组件中添加style={{textDecoration: 'none'}}来删除下划线。你也可以在样式块中添加更多的css,例如style={{textDecoration: 'none', color: 'white'}}。
<h1>
<Link style={{ textDecoration: 'none', color: 'white' }} to="/getting-started">
Get Started
</Link>
</h1>
其他回答
我看到你在使用内联样式。textDecoration: 'none'在child中使用,实际上它应该在<Link>中使用,如下所示:
<Link to="first" style={{ textDecoration: 'none' }}>
<MenuItem style={{ paddingLeft: 13 }}>Team 1</MenuItem>
</Link>
<Link>将返回一个标准的<a>标签,这就是为什么我们在这里应用textDecoration规则的原因。
你可以在你的scss文件中使用这段代码; 这将消除不需要的颜色变化,
a:-webkit-any-link {
&:hover {
color: white;
}
}
jsx:
<Link className="link">
test
</Link>
css:
.link{
text-decoration: none;
}
<Link />标签在呈现时基本上是<a>标签,所以你可以只写
a { text-decoration: none; }
这对我来说很有效:) 祝你好运
a {
text-decoration: none !important;
color: black !important;
font-size: 20px;
}
在App.css中使用