我想为超链接样式创建多个类。
我想要一个默认类以及一个用于导航菜单的特殊类。
这是我的 CSS 代码:
a {
color: white;
text-decoration: none;
}
.menu-items a {
color: black;
text-decoration: none;
}
我尝试在 html 中调用“menu-items”类,但它继续使用上面显示的默认 a{} 样式。
这是 html 代码:
<div class="container-outside">
<div class="container-inside">
<ul class="ul-list">
<li>
<a class="menu-items" href="temperature.html">Temperature</a></li>
<li>|</li>
<li>Weight</li>
<li>|</li>
<li>Currency</li>
</ul>
</div>
</div>
我尝试删除默认类并创建两个特殊类,但没有成功。这里有点不知所措。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
可以直接把类名.menu-items
您的选择器不正确,因为
menu-items不是as 父级。您应该像这样选择标签:a.menu-items { color: black; text-decoration: none;}