20

I have designed a form in which I have two items in a row, like this:

My output

enter image description here

Code that I used:

<div class="row">
    <div class="col-sm-3">  <!-- [1, 0] -->
        <fieldset class="form-group">
            <label id="fieldTitle">Equipment Length</label>
            <select id="selectOption" class="form-control" required data-error="Please select Equipment Length"></select>
            <div class="help-block with-errors"></div>
        </fieldset>
    </div>
    <div class="col-sm-9">  <!-- [1, 1] -->
        <fieldset class="form-group">
            <label id="fieldTitle">Customer Notes</label>
            <textarea class="form-control" placeholder="Please write customer notes" ng-model="myTextarea" required data-error="Please enter customer notes"></textarea>
            <div class="help-block with-errors"> {{myTextarea}} </div>
        </fieldset>
    </div>
</div>

So, please guide me how do I increase the height of the textarea just like my

desired output enter image description here please tell me how do I do it. Thanks

reiallenramos
  • 1,235
  • 2
  • 21
  • 29
Sikandar Sahab
  • 638
  • 3
  • 10
  • 27

6 Answers6

46

With Bootstrap 4 you will need to have the property rows and add "height: 100%;" so that the height would stretch to the number of rows specified. "rows" along does not work.

<textarea rows="10" style="height:100%;"></textarea>
user3399299
  • 569
  • 1
  • 4
  • 4
14
textarea {
  width: 300px;
  height: 150px;
}

adjust as needed.

reiallenramos
  • 1,235
  • 2
  • 21
  • 29
  • @core114 are you insinuating that I plagiarized? are you sure it's not a complete coincidence that I used that same values? – reiallenramos Nov 02 '18 at 06:40
  • 5
    @core114 In cases like this with a small piece of code it's unlikely that it's actual plagiarized. In comparison, when a greater part of code (let's say 15+ lines) is completely identical, it's very likely that it's plagiarism. But always asume good faith first. – Filnor Nov 02 '18 at 06:51
14

In HTML set

<textarea rows="10"></textarea>

In CSS set

textarea { height: 100px; }

I hope it helps.

Noriel
  • 218
  • 1
  • 7
11

With Bootstrap 4 you will need to add h-25 class

<textarea class="form-control h-25" rows="5" placeholder="Please write customer notes"></textarea>
Dantis Mathew
  • 119
  • 1
  • 2
10

the class form-control remove textarea rows attribute so just replace it with col-md-12

<textarea class="col-md-12" placeholder="Please write customer notes" ng-model="myTextarea" required data-error="Please enter customer notes"></textarea>
Hisham
  • 1,279
  • 1
  • 17
  • 23
1

Not a big fan of changing globally the textarea css attr.

Would rather use a specific css class, but it could be overriden by some other classes, so you could use the !important, even tho it is not a best practice.

{{ form_widget(form.myTextarea,{'attr': {'class': 'specific-textarea'}}) }}

And add in your CSS

.specific-textarea { height: 200px !important; }
Jean-Christophe Meillaud
  • 1,961
  • 1
  • 21
  • 27