Search code examples
phptwitter-bootstrap-2

How can I remove extra space from input form dropdown in BootStrap?


I am trying to make a input form dropdown using bootstrap(BootStrap version 2.3.2), but my form dropwdown make a irrelevant space with it.

This is my code:

    <div class="control-group" >
      <label class="control-label">Event Name</label>
      <div class="controls">
        <div class="input-prepend">

        <? $result=$this->db->get("EventType")->result();
           foreach($result as $res){
             $event[$res->Id]=$res->Name;
           }
           $event["Select"]="Select";
           $js = 'id="events" class="input-large" onChange="some_function();"';
           echo form_dropdown("event_type",$event, 'Select',$js); ?>
        </div>
        <? echo '<span style=color:red>'.form_error('event_name').'</span>'; ?>
      </div>
    </div>

Rendered HTML:

<div class="control-group">
    <label class="control-label">Event Name</label>
    <div class="controls">
        <div class="input-prepend">
            <select name="event_type" id="events" class="width" onChange="some_function();">
                <option value="6">Music</option>
                <option value="7">Seminar</option>
                <option value="8">Sports</option>
                <option value="9">Movie</option>
                <option value="11">Conference</option>
                <option value="Select" selected="selected">Select</option>
            </select>
        </div> <span style=color:red></span>    
    </div>
</div>

This is my output image enter image description here

There is a gap between button of a dropdown and input text(Right side gap of the text). How can I remove this gap?

But, I want to make this input form dropdown like as enter image description here No extra space of right side.


Solution

  • May be there is a style in your css for select or textarea. Whatever, You can use this style for select.

      .select,
        textarea,
        input[type="text"]{
        padding:0px;
       }
    

    I hope you will success.So,Try it.