Input-group-btn从字段右侧浮动

时间:2015-01-07 22:20:59

标签: javascript jquery html css

targetDate元素的input-group-btn保持固定在输入组的右侧,与屏幕宽度无关,直到我添加了hottowel生成器附带的自动生成的CSS。 我需要一些帮助来确定CSS的哪些方面影响行为。

查看此jsfiddle
尝试了所有3种尺寸的网格布局无济于事但我不认为这是问题。

<section class="mainbar">
<section class="matter">
    <div class="container">
        <div class="row">
            <div class="widget wviolet">
                <div ht-widget-header title="{{vm.title}}"></div>
                <div class="widget-content user">

                    <form name="submitjobform" novalidate  id="submitjobform" ng-submit="vm.processForm()">
                    <div class="form-group">
                        <div class="row">
                            <label for="name" class="col-lg-2 control-label">Name</label>
                            <div class="col-lg-10">
                                <input ng-model="vm.submitjobform.name" type="text" class="form-control" name="name" ng-required="true" >
                                <span class="error" ng-show="submitjobform.name.$error.required">Required!</span>
                            </div> <!--  </div>  col-lg-10 -->
                        </div> <!--  </div>  row -->
                   </div> <!--  </div>  form-group -->
                   <div class="form-group">
                        <div class="row">
                            <label for="description" class="col-lg-2 control-label">Description</label>
                            <div class="col-lg-10">
                                <textarea  ng-model="vm.submitjobform.description" class="form-control" name="description" ng-required="true" ></textarea>
                                <span class="error" ng-show="submitjobform.description.$error.required">Required!</span>
                            </div> <!--  </div>  col-lg-10 -->
                        </div> <!--  </div>  row -->
                    </div> <!--  </div>  form-group -->  
                    <div class="form-group">
                        <div class="row">
                            <label for="category" class="col-lg-2 control-label">Category</label>
                            <div class="col-lg-10">
                                <select ng-model="vm.submitjobform.category" class="form-control" name="category" ng-required="true" ng-options="name.name for name in vm.categories"></select>
                                <span class="error" ng-show="submitjobform.category.$error.required">Required!</span>
                            </div> <!--  </div>  col-lg-10 -->
                          </div> <!--  </div>  row -->
                    </div> <!--  </div>  form-group --> 
                    <div class="form-group">
                        <div class="row">
                            <label for="assignee" class="col-lg-2 control-label">Assignee</label>
                            <div class="col-lg-10">
                                <select ng-model="vm.submitjobform.assignee" class="form-control" name="assignee" ng-required="true" ng-options="name.name for name in vm.names"></select>
                                <span class="error" ng-show="submitjobform.assignee.$error.required">Required!</span>
                            </div> <!--  </div>  col-lg-10 -->
                            </div> <!--  </div>  row -->
                    </div> <!--  </div>  form-group -->
                     <div class="form-group">   
                        <div class="row">
                            <label for="targetDate" class="col-lg-2 control-label">Target Date</label>
                            <div class="col-lg-8">
                                <!-- <div class="col-lg-4"> -->
                                    <div class="input-group">
                                        <input name="targetDate" type="text" class=" form-control" datepicker-popup="{{vm.format}}" ng-model="vm.submitjobform.targetDate" is-open="vm.opened" min-date="vm.minDate" max-date="'2015-06-22'" datepicker-options="vm.dateOptions" date-disabled="vm.disabled(date, mode)" ng-required="true" close-text="Close"> 
                                        </input>
                                        <span class="input-group-btn">
                                            <!-- " -->
                                            <button type="button" class="btn btn-default" ng-click="vm.open($event)">
                                                <i class="glyphicon glyphicon-calendar"></i>
                                            </button>
                                        </span>
                                    </div> <!--input group -->
                                <!-- </div> /col-lg-4  -->
                            </div>  <!--/col-lg-8 -->
                        </div> <!--  </div>  row -->
                    </div> <!--  </div>  form-group -->     
                        <div class="form-group">
                            <div class="row">
                                <div class="col-lg-2">
                                    <input type="submit" ng-disabled="submitjobform.$invalid" value="Submit" id="submitjobform_submit" class="btn btn-danger">
                                </div>  <!--/col-lg-2 -->
                            </div>
                        </div>
                        <div>
                        <tt>name = {{vm.submitjobform.name}}</tt><br/>
                        <tt>desc = {{vm.submitjobform.description}}</tt><br/>
                        <tt>category = {{vm.submitjobform.category.name}}</tt><br/>
                        <tt>assignee = {{vm.submitjobform.assignee.name}}</tt><br/>
                        <tt>targetdate = {{vm.submitjobform.targetDate}}</tt><br/>
                        </div>
                    </form>
                    </div> <!-- content-user div -->
                <div class="widget-foot">
                    <div class="clearfix"></div>    
                </div>
            </div> <!-- widget violet -->
            </div> <!-- row div -->
        </div> <!-- container div -->
    </section>
</section>

由于

西蒙

1 个答案:

答案 0 :(得分:0)

http://jsfiddle.net/voykuL65/

我假设您正在使用引导程序,因为您在小提琴中将其导入css中。

主要问题是你也不包括bootstrap JS。如果您在小提琴中删除CSS并切换framekwors&amp;扩展到jquery 2.1并选择Bootstrap 3.2你的代码看起来很好。

要记住的另一点是设计引导程序最小。

你已经拥有了一切

class="col-lg-2" 

你可能刚刚修修补补,但请记住从xs / sm开始并向更大的方向移动。

还有一个流浪</input>也会杀死他。