css - 如何在 CSS 中为链接添加装饰?

标签 css

我有以下有效的方法:

#s5_bottom_menu_wrap a{
color:#333333 !important;
}

我希望能够向其中添加以下内容:

a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:none;}

但是,当我这样做时:

#s5_bottom_menu_wrap a{
color:#333333 !important;
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:none;}
}

...在 Google Chrome 的 Inspect Element 中,它为添加的 CSS 显示错误“Unknown property name”,并且没有任何效果。我想做的是按照设计者的要求去做,即让这些 Nav 链接没有装饰,并且仅在悬停时为链接加下划线。

我做错了什么?应该如何添加这些文本装饰?

我已经根据我在这里得到的答案尝试过这个,这是正确的吗?

/* bottom section Nav links in footer */
#s5_bottom_menu_wrap a{ color:#333333 !important; text-decoration:none;}
#s5_bottom_menu_wrap a:link {text-decoration:none;}
#s5_bottom_menu_wrap a:visited {text-decoration:none;}
#s5_bottom_menu_wrap a:hover {text-decoration:underline;}
#s5_bottom_menu_wrap a:active {text-decoration:none;}

最佳答案

您正在将样式添加到 :link:visited:hover:activea 元素的 css 样式 block 。这是行不通的。而是尝试以下操作

#s5_bottom_menu_wrap a{ 颜色:#333333 !重要;文字装饰:无; }

#s5_bottom_menu_wrap a:hover {text-decoration:underline;}

关于css - 如何在 CSS 中为链接添加装饰?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19197776/

相关文章:

css - 纯 css 对话

jquery - 登陆第一个 div,向下滚动到下一个 div,并禁用滚动回第一个 div。如何做到这一点?

html - 在 flexbox 列中垂直居中单个元素

html - 对齐 asp :Button above first column of the gridview below

javascript - 如何在完成具有 6 个 slider 图像的 1 个循环后停止 cb 幻灯片

css - 如何在 react 组件上添加多个类名

html - <body> 比它应该的大

css - WordPress 网站页面和帖子(左侧和右侧)的填充调整

html - Chrome 溢出 : scroll CSS issue (phantom margin/padding)

java - 在没有 <mvc :resources/> tag 的情况下在 Freemarker 中使用 CSS 样式文件