Bootstrap 选项卡式表单更改宽度
Bootstrap tabbed form changes width
我正在使用 Bootstrap 制作一个选项卡式表单。我做了一行,其中有两列,一列的宽度为 col-md-9
,一列的宽度为 col-md-3
。但是,当我将数据放入其中一个选项卡时,它会使该选项卡比 col-md-3
的列宽。但我希望最大宽度为 col-md-3
有人知道我做错了什么吗?
事情是这样的:
这是我的 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>
问题正如您在评论中提到的,样式
float:none;
需要从您的地图 ID 中删除,以在不同屏幕尺寸下保持格式不变。
我遇到了同样的问题。我的解决方案最终是我错误地(出于习惯)使用了 Bootstrap 3 标签 (col-xs-12) 而不是 4 的 col-12。一旦更改了应有的大小。
我正在使用 Bootstrap 制作一个选项卡式表单。我做了一行,其中有两列,一列的宽度为 col-md-9
,一列的宽度为 col-md-3
。但是,当我将数据放入其中一个选项卡时,它会使该选项卡比 col-md-3
的列宽。但我希望最大宽度为 col-md-3
有人知道我做错了什么吗?
事情是这样的:
这是我的 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>
问题正如您在评论中提到的,样式
float:none;
需要从您的地图 ID 中删除,以在不同屏幕尺寸下保持格式不变。
我遇到了同样的问题。我的解决方案最终是我错误地(出于习惯)使用了 Bootstrap 3 标签 (col-xs-12) 而不是 4 的 col-12。一旦更改了应有的大小。