[英]Can't set text-area to width: 100% using bootstrap
I'm trying to set a textarea in rails to be the width of its container. 我正在尝试在rails中将textarea设置为其容器的宽度。 I've tested that the css is working on the textarea.
我已经测试过CSS在textarea上工作。
Form View: 表格检视:
<%= form_tag("/pages/thank_you") do %>
<div class="row">
<div class="col-md-6">
<div class="input-group">
<%= text_area_tag :message, nil, class: 'form-control text-area-wide', placeholder: 'Enter Message' %>
</div>
</div>
</div>
<%= submit_tag 'Send Message', class: 'btn btn-success' %>
<% end %>
CSS: CSS:
.text-area-wide {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
}
In bootstrap you should use the col classes in place of fixed width to keep responsive design change the col to col-md-12 在引导程序中,应使用col类代替固定宽度,以保持响应设计将col更改为col-md-12
<div class="row"> <div class="col-md-12"> <div class="input-group"> <%= text_area_tag :message, nil, class: 'form-control text-area-wide', placeholder: 'Enter Message' %> </div> </div> </div>
The limit on the width of the text area in this case was the .input-group div. 在这种情况下,文本区域宽度的限制是.input-group div。 Setting the width of that div with css will change the width of the text-area.
使用CSS设置该div的宽度将更改文本区域的宽度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.