【发布时间】:2014-06-27 18:55:47
【问题描述】:
<%= link_to "Sign In", new_user_session_path, :method => :get, style: "color:white" %>
<h3>Read More - <%= link_to 'Article', action: :articles, style: "color: purple" %></h3>
<%= link_to 'Click to Read More About What People Are Saying About Us', action: :articles %>
所以我在一个 html.erb 文件的正文中有上述三行代码。
如我所愿,第一个“登录”显示为白色。
第二个“文章”链接显示为黑色!我想要紫色。
第三个,显示为灰色。但我希望它是白色的。
我的问题到底是什么?我正在尝试同时学习 rails 和 css。
以下是我的总体脚手架.css.scss 文件:
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}
a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}
div {
&.field, &.actions {
margin-bottom: 10px;
}
}
#notice {
color: green;
}
.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}
#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: black;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
编辑:添加渲染 HTML:
<a data-method="get" href="/users/sign_in" style="color:white">Sign In</a>
<h3>Read More - <a href="/articles?style=color%3A+purple">Articles</a></h3>
<a href="/articles">Click to Read More About What People Are Saying About Us</a>
【问题讨论】:
-
生成的标签是否正确呈现?
-
是的,所有标签都链接到正确的视图
-
你能粘贴呈现的 HTML 吗?
标签: html ruby css ruby-on-rails-4 sass