Queen of the North
Queen of the North

Reputation: 37

Can't change input form width

I'm making a form and I want the left half of the page to fill up the section. I have tried col-lg-4, changing the CSS width to 100%, nothing is changing the actual input field. I have searched Stack Overflow, but I couldn't find anything that worked. The first picture is what I have, and the second picture is what I was trying to recreate.

<section class="col-md-6">

        <form class="form-group row">

            <div class="form-group">
                <input type="text" class="form-control" id="inputEmail" placeholder="Cool Person">
            </div>

            <div class="form-group">
                <input type="email" class="form-control" id="inputEmail" placeholder="[email protected]">
            </div>

            <div class="form-group">
                <input type="text" class="form-control" id="inputSubject" placeholder="what's up?">
            </div>

            <div class="form-group">
                <textarea rows="6" class="form-control" placeholder="What's on your mind?"></textarea>
            </div>

        </form>

    </section>

Form with wrong input widths

Form with correct input widths

Upvotes: 1

Views: 11209

Answers (3)

Habeeb
Habeeb

Reputation: 352

set css display property to inline-block and give width 100%

.form-control{
   display:inline-block;
   width:100%
}

Upvotes: 1

Ahmed Tolba
Ahmed Tolba

Reputation: 18

ok first of all you cannot have two elements with the same id, because only the last element will get to have that id and the first one won't

to answer your question try to this in css

.form-group, .form-control {width : 100%;}

I'd rather though you'd give an id to your form and then call these classes as its children, like -#form_id .form-group {...

Upvotes: 0

Srinivas GV
Srinivas GV

Reputation: 167

use bootstrap div as mentioned below and try

<div class="container">
  <div class="row">
    <div class="col-md-6">
      <div class="form-group">
            <input type="text" class="form-control" id="inputEmail" 
                 placeholder="Cool Person">
            </div>

            <div class="form-group">
                <input type="email" class="form-control" id="inputEmail" placeholder="[email protected]">
            </div>

            <div class="form-group">
                <input type="text" class="form-control" id="inputSubject" placeholder="what's up?">
            </div>

            <div class="form-group">
                <textarea rows="6" class="form-control" placeholder="What's on your mind?"></textarea>
            </div>
    </div>
    <div class="col-sm-6">
      Maps Section Comes Here!
    </div>
     </div>
</div>

Upvotes: 0

Related Questions