If I change the value of :rows, it works. But it stays at the default cols whatever value I set with \':cols =>\'. Column width won\'t change.
I viewed the html source a
This works for me with twitter bootstrap 2 and simple_form 2.0.4
Result is a span6 text area in a span9 row
<div class="row" >
<div class="span9">
<%= f.input :some_text, :input_html => {:rows => 5, :placeholder => "Enter some text.", :class => "span6"}%>
</div>
</div>
UPDATE: As of Bootstrap 3.0, the input-*
classes described below for setting the width of input elements were removed. Instead use the col-*
classes to set the width of input elements. Examples are provided in the documentation.
In Bootstrap 2.3, you'd use the input classes for setting the width.
<textarea class="input-mini"></textarea>
<textarea class="input-small"></textarea>
<textarea class="input-medium"></textarea>
<textarea class="input-large"></textarea>
<textarea class="input-xlarge"></textarea>
<textarea class="input-xxlarge"></textarea>
<textarea class="input-block-level"></textarea>
Do a find for "Control sizing" for examples in the documentation.
But for height I think you'd still use the rows attribute.
I don't know if this is the correct way however I did this:
<div class="control-group">
<label class="control-label" for="id1">Label:</label>
<div class="controls">
<textarea id="id1" class="textareawidth" rows="10" name="anyname">value</textarea>
</div>
</div>
and put this in my bootstrapcustom.css file:
@media (min-width: 768px) {
.textareawidth {
width:500px;
}
}
@media (max-width: 767px) {
.textareawidth {
}
}
This way it resizes based on the viewport. Seems to line everything up nicely on a big browser and on a small mobile device.
The other answers didn't work for me. This did:
<div class="span6">
<h2>Document</h2>
</p>
<textarea class="field span12" id="textarea" rows="6" placeholder="Enter a short synopsis"></textarea>
<button class="btn">Upload</button>
</div>
Note the span12
in a div with span6
.
I found the following in the site.css generated by VS2013
/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
max-width: 280px;
}
To override this behavior in a specific element, add the following...
style="max-width: none;"
For example:
<div class="col-md-6">
<textarea style="max-width: none;"
class="form-control"
placeholder="a col-md-6 multiline input box" />
</div>
Simply add the bootstrap "row-fluid" class to the textarea. It will stretch to 100% width;
Update: For bootstrap 3.x use "col-xs-12" class for textarea;
Update II: Also if you want to extend the container to full width use: container-fluid class.