我正在为项目使用引导程序,并且试图在同一行上使用可协作对象。它们出现在同一行上,但是如果我下拉第一个可折叠对象,则其他可折叠对象将向下移动到第一个可折叠对象中。
我目前有两个可折叠的文字,如下所示:
<div class="row">
<div class="container">
<h2>Nerve Cuffs</h2>
<hr>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#2-Channel">2-Channel Nerve Cuffs <i class="fas fa-angle-down"></i></button>
<div id="2-Channel" class="collapse">
<div class="row">
<div class="col-6">
<h4>NC-630-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#1">Specifications <i class="fas fa-angle-down"></i></button>
<div id="1" class="collapse">
<p>Electrode Length: 0.630mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.095 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 5.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>
Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
<div class="row">
<div class="col-6">
<h4>NC-1210-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#2">Specifications <i class="fas fa-angle-down"></i></button>
<div id="2" class="collapse">
<p>Electrode Length: 1.210mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.182 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>
Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
<div class="row">
<div class="col-6">
<h4>NC-1620-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#3">Specifications <i class="fas fa-angle-down"></i></button>
<div id="3" class="collapse">
<p>Electrode Length: 1.620mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.243 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>
Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
<div class="row">
<div class="col-6">
<h4>NC-2600-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#4">Specifications <i class="fas fa-angle-down"></i></button>
<div id="4" class="collapse">
<p>Electrode Length: 2.600mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.390 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
</div>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#4-Channel">4-Channel Nerve Cuffs <i class="fas fa-angle-down"></i></button>
<div id="4-Channel" class="collapse">
<div class="row">
<div class="col-6">
<h4>NC-1210-4</h4>
</div>
</div>
<h5><span class="badge badge-secondary">4-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#5">Specifications <i class="fas fa-angle-down"></i></button>
<div id="5" class="collapse">
<p>Electrode Length: 1.210mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.182 mm<sup>2</sup> <br>
Electrode Sites: 4 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 4.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
</div>
</div>
</div>
感谢您的帮助!
答案 0 :(得分:0)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<h2>Nerve Cuffs</h2>
<hr>
<div class="row">
<div class="col">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#2-Channel">2-Channel Nerve Cuffs <i class="fas fa-angle-down"></i></button>
</div>
<div class="col">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#4-Channel">4-Channel Nerve Cuffs <i class="fas fa-angle-down"></i></button>
</div>
</div>
<div class="row">
<div class="col">
<div id="2-Channel" class="collapse">
<div class="row">
<div class="col-6">
<h4>NC-630-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#1">Specifications <i class="fas fa-angle-down"></i></button>
<div id="1" class="collapse">
<p>Electrode Length: 0.630mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.095 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 5.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>
Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
<div class="row">
<div class="col-6">
<h4>NC-1210-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#2">Specifications <i class="fas fa-angle-down"></i></button>
<div id="2" class="collapse">
<p>Electrode Length: 1.210mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.182 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>
Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
<div class="row">
<div class="col-6">
<h4>NC-1620-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#3">Specifications <i class="fas fa-angle-down"></i></button>
<div id="3" class="collapse">
<p>Electrode Length: 1.620mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.243 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>
Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
<div class="row">
<div class="col-6">
<h4>NC-2600-2</h4>
</div>
</div>
<h5><span class="badge badge-secondary">2-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#4">Specifications <i class="fas fa-angle-down"></i></button>
<div id="4" class="collapse">
<p>Electrode Length: 2.600mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.390 mm<sup>2</sup> <br>
Electrode Sites: 2 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 2.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
</div>
</div>
<div class="col">
<div id="4-Channel" class="collapse">
<div class="row">
<div class="col-6">
<h4>NC-1210-4</h4>
</div>
</div>
<h5><span class="badge badge-secondary">4-Channel</span></h5>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#5">Specifications <i class="fas fa-angle-down"></i></button>
<div id="5" class="collapse">
<p>Electrode Length: 1.210mm <br>
Electrode Width: 0.150m <br>
Electrode Area: 0.182 mm<sup>2</sup> <br>
Electrode Sites: 4 <br>
Electrode Spacing: 1.000m
</p>
<p>Device Length: 10.000m <br>
Device Width: 4.00mm <br>
Device Thickness: 30 ± 5 μm
</p>
<p>Standard Electrode Material: TiN <br>
Connector Options: Bare wires, Plastics One, Omnetics
</p>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
使用bootstrap col将解决您的问题。将每个按钮的内容与col连续放置。