【问题标题】:How do I change the background color of a form text_area?如何更改表单 text_area 的背景颜色?
【发布时间】:2014-10-14 22:05:33
【问题描述】:

我博客的背景颜色是蓝色,我想将text_area 表单的背景颜色设为白色,但目前text_area 表单与我的博客背景颜色相同。

下面的代码text_field的背景是白色的,提交按钮的背景也是白色的,但text_area的背景仍然是蓝色的。



html.erb 代码:

<div class="post">
  <%= form_for @post do |f| %>
    <%= f.label :title %>
    <%= f.text_field :title %><br>
    <%= f.label :post %> <br>
    <%= f.text_area :post, size: "95x20"  %><br>
  <%= f.submit %>
<%end%>
</div>

css代码:

.post input {
  background-color: white;
}

【问题讨论】:

    标签: html css ruby-on-rails erb


    【解决方案1】:

    只需将背景应用到textarea 元素,例如:

    .post textarea {
      background-color: yellow;
    }
    <div class="post">
      <textarea></textarea>
    </div>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-11
      相关资源
      最近更新 更多