html - 如何更改导航元素内的字体颜色?

标签 html css colors nav

我有一个元素,我想更改其中链接的颜色,但我页面上的所有其他链接都使用以下 CSS 设置样式:

a:link {

    color:#22b14c;
    text-decoration:none;
    }

这是导航:

<nav id="Nav">
        <a href="index.html">Home</a> |
        <a href="Gallery.html">Library</a> |
        <a href="Contact.html">Contact</a> |
        <a href="About.html">About</a>
</nav>

和导航 CSS:

#Nav {

    margin-top: 20px;
    background-color: #000000;
    color: #f2f2f2;
    font-size: 40px;
    font-family: "Calibri";
    text-align: center;
    }

我尝试在 nav 元素内设置 span,但没有成功。如何仅在元素内更改这些链接的颜色?

最佳答案

你在找这个吗:

#Nav a{
     color: #f2f2f2;
     text-decoration:none;
}

#Nav a:hover {
    color: blue;
    text-decoration: underline;
}

关于html - 如何更改导航元素内的字体颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19616717/

相关文章:

html - 让表格填充其余宽度

html - 为什么 align-self 属性在使用 flex 时不适用于导航栏?

jquery - jqGrid tableToGrid 插件相同的 HTML 代码但 TD 高度问题

css - 溢出:隐藏在 static 以外的位置在 chrome 和 safari 中不起作用,这是新的吗?这是一个错误吗?

java - 如何在 Robocode 上设置 alpha 颜色?

android - 更改 android 操作栏的背景颜色,基本教程

javascript - 使用 JavaScript 插入元素的最佳方式

html - 限制一页上特定 div 类的数量(wordpress)

html - 如何处理我的导航栏以使其看起来像图片中的那样?

pandas - 设置 pandas 索引单元格的背景颜色