Bootstrap选项卡式更改宽度

时间:2016-02-24 17:21:12

标签: jquery html css forms tabs

我正在使用Bootstrap创建一个带标签的表单。我创建了一个包含两列的行,一行的宽度为col-md-9,另一行的宽度为col-md-3。但是,当我将数据放在其中一个标签中时,它会使该标签比col-md-3的列宽。但我希望最大宽度为col-md-3有人知道我做错了什么吗?

这是发生的事情: enter image description here

这是我的index.html页面:

<!DOCTYPE HTML>
<html>
    <head>        
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
          <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

        <title>Test Map</title>
        <link rel="stylesheet" href="lib/jquery/jquery-ui.css">       
        <link rel="stylesheet" href="lib/leaflet/leaflet.css">
        <link rel="stylesheet" href="css/style.css">
        <link rel="stylesheet" href="css/bootstrap.min.css">
    </head>

    <body>    
    <!-- begin webviewer content -->
        <div class="container-fluid">
            <div class="row">
                <!-- div voor de webmap -->
                <div class="col-md-9" id="map"></div>

                <!-- div voor het formulier -->
                <div class="col-md-3" id="form">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">Legenda <i class="fa"></i></a></li>
                        <li><a href="#tab2" data-toggle="tab">Layers <i class="fa"></i></a></li>
                        <li><a href="#tab3" data-toggle="tab">Advanced selection <i class="fa"></i></a></li>
                    </ul>
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab1">
                             <form action="javascript:submitQuery()">    
                                <fieldset class="form-group">
                                    <label for="distance">Show features within</label>
                                    <input type="text" class="form-control" id="distance" placeholder="enter km" name="distance"></input>
                                    <label for="featname">km of features named</label>
                                    <input type="text" class="form-control" id="featname" placeholder="Enter feature name" name="featname"></input>
                                    <button type="submit" class="btn btn-primary" value="Submit">Submit</button>
                                </fieldset>
                             </form>
                            </div>  
                            <div class="tab-pane" id="tab2">
                                <h1>HIER MOET ZOOI VOOR TAB 2</h1>
                            </div>
                            <div class="tab-pane" id="tab3">
                                <h3>HIER MOET ZOOI VOOR TAB 3</h3>
                            </div>
                        </div>     
                </div>
            </div>
        </div>

<!-- einde webviewer content -->

<!-- links naar scripts -->
        <script type="text/javascript" src="lib/jquery/jquery.js"></script>
        <script type="text/javascript" src="lib/jquery/jquery-ui.js"></script>
        <script type="text/javascript" src="lib/leaflet/leaflet.0.7.3-src.js"></script>
        <script type="text/javascript" src="js/main.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
    </body>
</html>

2 个答案:

答案 0 :(得分:1)

问题正如您在评论中提到的那样,造型

float:none;

需要从地图ID中删除

,以使格式在不同的屏幕尺寸上保持不变。

答案 1 :(得分:0)

我有同样的问题。我的解决方案最终是我误用了Bootstrap 3标签(col-xs-12)而不是4的col-12(出于习惯)。更改表单大小后,就可以了。