我无法理解为什么“list-group panel”与本例中的第二列不对齐。我将整个bootstrap css和js文件插入到jsfiddle示例中,不知道如何引用此代码,否则...
https://jsfiddle.net/oyc9s9gt/
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Title</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="wrapper">
<div class="container-flexible">
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*1*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*2*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*3*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*4*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*5*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*6*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*7*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*8*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*9*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*10*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*11*</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1">*12*</div>
</div>
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">8 Columns</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<div id="MainMenu">
<div class="list-group panel">
<a href="#" class="list-group-item list-group-item-success" data-parent="#MainMenu">Item 1</a>
<a href="#" class="list-group-item list-group-item-success" data-parent="#MainMenu">Item 2</a>
<a href="#demo3" class="list-group-item list-group-item-success" data-toggle="collapse" data-parent="#MainMenu">Item 3 <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="demo3">
<a href="#SubMenu1" class="list-group-item" data-toggle="collapse" data-parent="#SubMenu1">Subitem 1 <i class="fa fa-caret-down"></i></a>
<div class="collapse list-group-submenu" id="SubMenu1">
<a href="#" class="list-group-item" data-parent="#SubMenu1">Subitem 1 a</a>
<a href="#" class="list-group-item" data-parent="#SubMenu1">Subitem 2 b</a>
<a href="#SubSubMenu1" class="list-group-item" data-toggle="collapse" data-parent="#SubSubMenu1">Subitem 3 c <i class="fa fa-caret-down"></i></a>
<div class="collapse list-group-submenu list-group-submenu-1" id="SubSubMenu1">
<a href="#" class="list-group-item" data-parent="#SubSubMenu1">Sub sub item 1</a>
<a href="#" class="list-group-item" data-parent="#SubSubMenu1">Sub sub item 2</a>
</div>
<a href="#" class="list-group-item" data-parent="#SubMenu1">Subitem 4 d</a>
</div>
<a href="javascript:;" class="list-group-item">Subitem 2</a>
<a href="javascript:;" class="list-group-item">Subitem 3</a>
</div>
<a href="#demo4" class="list-group-item list-group-item-success" data-toggle="collapse" data-parent="#MainMenu">Item 4 <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="demo4">
<a href="" class="list-group-item">Subitem 1</a>
<a href="" class="list-group-item">Subitem 2</a>
<a href="" class="list-group-item">Subitem 3</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Latest compiled and minified JQuery code -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<!-- Latest compiled and minified BootStrap Code -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
答案 0 :(得分:0)
第二栏?你指的是文字“8列”吗?如果是,则删除#MainMenu和8列
上方的div标签<div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
这个div位于#MainMenu
之上<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
这应该有所帮助。如果您有其他意思,请解释