我有一个a标签和一个li里面。 a标签给列表项目innterText添加颜色。如何取消其对内容颜色的影响并删除下划线?如何删除<a>标签的装饰
代码:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul>
<a href="google.com"><li>asd</li></a>
</ul>
</body>
</html>
我有一个a标签和一个li里面。 a标签给列表项目innterText添加颜色。如何取消其对内容颜色的影响并删除下划线?如何删除<a>标签的装饰
代码:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul>
<a href="google.com"><li>asd</li></a>
</ul>
</body>
</html>
是无效的。在你的方式<a>
内<ul>
标签,并且它也将不会通过W3C validation。但是,如果我理解你的问题,你可以试试这个:
<ul>
<li>
<a href="#">
<ul>
<li>asd</li>
</ul>
</a>
</li>
</ul>
为了删除下划线,你可以这样做:
ul li a {
text-decoration: none;
color: #b61c1c; /* For Example */
}
你可以样式像这样:
<a style="text-decoration: none; color: #TheColorYouWant"></a>
这不会删除应用的颜色 –
@DarrenSweeney是的,我忘了颜色。编辑。 –
试试这个:
a {
background-color: transparent;
}
a:hover {
text-decoration: none;
}
使用CSS。这将删除下划线从和li元素:
a, li {
text-decoration: none !important;
}
只需添加本类中你的要求你的风格“一:-webkit-任何联系”。例如,如果你想删除下划线,那么只需添加“a:-webkit-any-link {text-decoration:none;}”。 注意:这里我们使用'-webkit-'作为Chrome浏览器。
您可能想要使用markdown格式化您的代码样本 - 请参阅[在帮助部分中进行降价](https://stackoverflow.com/help/formatting) –
请发表你的代码,或者更好,创建一个片段。 – Gerry