Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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
Html 如何将背景色应用于课堂的整个区域_Html_Css_Ruby On Rails_Ruby On Rails 4 - Fatal编程技术网

Html 如何将背景色应用于课堂的整个区域

Html 如何将背景色应用于课堂的整个区域,html,css,ruby-on-rails,ruby-on-rails-4,Html,Css,Ruby On Rails,Ruby On Rails 4,我想更改整个类区域的背景色(class=“test\u detail”),但只更改文本后面的颜色 我使用Rails4 index.html.erb . . . <% @calendar.each do |c| %> . . . <aside class="span7"> <span class="test_detail"> <% if c.day? %> <%= c.day %> <

我想更改整个类区域的背景色(class=“test\u detail”),但只更改文本后面的颜色

我使用Rails4

index.html.erb

.
.
.
<% @calendar.each do |c| %>
.
.
.
<aside class="span7">
    <span class="test_detail">
      <% if c.day? %>
        <%= c.day %>
      <% else %>
        xxx
      <% end %>
      <br>
       xxx <%= link_to "xxx", 'http://xxx' %>
    </span>
</aside>
.
.
.
<% end %>

字体大小
颜色
有效,但
背景色
似乎不起作用。

这是因为您使用的是
span
而不是
div
-默认情况下是内联的,因此在这种情况下,您只能看到文本后面的背景色变化


是,因为背景色只会更改背景,而不会更改您已经使用过的颜色的文本颜色谢谢您的评论,invalidfunction。它使用
div
而不是
span
.test_detail {
  font-size: 12px;
  color: gray;
  background-color: orange;
}