Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 轨道:无法更改悬停颜色?_Css_Ruby On Rails - Fatal编程技术网

Css 轨道:无法更改悬停颜色?

Css 轨道:无法更改悬停颜色?,css,ruby-on-rails,Css,Ruby On Rails,当我悬停此链接时: <div id="withLibre"> by <%= link_to p.user.username, "#", {class: "username_link"} %><%=time_ago_in_words(p.created_at) %> ago </div> 有什么建议吗?从项目“scaffold.css.scss”中删除,。此文件包含导致问题的锚点的样式: a { color: #000; &

当我悬停此链接时:

<div id="withLibre">
    by <%= link_to p.user.username, "#", {class: "username_link"} %><%=time_ago_in_words(p.created_at) %> ago 
</div>
有什么建议吗?

从项目“scaffold.css.scss”中删除,。此文件包含导致问题的锚点的样式:

a {
  color: #000;
  &:visited {
    color: #666;
  }
  &:hover {
    color: #fff;
    background-color: #000;
  }
}
或删除此剪断的表单scaffold.css.scss文件

第二,删除类周围的“{}”,但我不知道这是否是一个打字错误

<%= link_to p.user.username, "#", class: "username_link" %>

祝你好运

可能是一个“优先”问题。试试这个:

#withLibre .username_link:hover{
    background-color: transparent;
    color: #34DDDD;
    text-decoration: none;
}

背景色:透明!重要的

也许您的资产文件夹中有一些脚手架CSS文件。是的,我有。我试图删除它,但没有成功。有什么建议吗?如果你不打算使用脚手架CSS,那么你可以删除,问题很可能是你的样式与脚手架生成的样式冲突。使用Chrome开发工具或Firebug查看应用了什么CSS规则及其来源。编辑:
背景色:透明因为
none
不是有效值。是的,这有效!突然我也可以改变背景颜色了,嗯?不管怎样,它起作用了:)谢谢。
#withLibre .username_link:hover{
    background-color: transparent;
    color: #34DDDD;
    text-decoration: none;
}