Bla*_*umb 30 html css twitter-bootstrap
我准备更新我的网站来引导3,但我无法弄清楚如何更换了nav-list从引导2类.
我查看了列表组,但我不确定这是否用于替换导航列表.如何在Bootstrap 3中使下面的标记工作?
<div class="well">
<ul class="nav nav-list">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
这就是我想要的样子:http://jsfiddle.net/bplumb/2Nguy/
Ror*_*ane 26
删除.nav-list 已记录在迁移到v3.x中 - 删除了什么:
导航列表
.nav-list.nav-header
没有直接等效,但列表组和.panel-groups类似.
我发现在"WIP:Bootstrap 3"拉取请求中的更改日志中列出了此更改:
- 删除
.nav-list选项.替换为新.list-group组件.
因此,如果我将您的代码翻译为使用.list-group,我会得到:
<div class="well">
<ul class="list-group">
<li class="list-group-item"><a href="#">Link 1</a></li>
<li class="list-group-item"><a href="#">Link 2</a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="well">
<ul class="list-group">
<li class="list-group-item"><a href="#">Link 1</a></li>
<li class="list-group-item"><a href="#">Link 2</a></li>
</ul>
</div>Run Code Online (Sandbox Code Playgroud)
但是,这看起来与Bootstrap 2中的方式不同.正如我在本回答的评论中所指出的,似乎没有.nav-list与Bootstrap 3 完全等效的内置.因此,如果你需要.list-group没有的功能,那么你将自己编写CSS,或尝试从Bootstrap 2移植它.
以下.less会nav-list像2.3.2中那样或多或少地带回来:
@import "../bootstrap/variables.less"; // replace with path to bootstrap variables.less
// Nav headers (for dropdowns and lists)
.nav-header {
display: block;
padding: 3px 15px;
font-size: 11px;
font-weight: bold;
line-height: @line-height-small;
color: @gray-light;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
text-transform: uppercase;
}
// Space them out when they follow another list item (link)
.nav li + .nav-header {
margin-top: 9px;
}
// NAV LIST
// --------
.nav-list {
padding-left: 15px;
padding-right: 15px;
margin-bottom: 0;
}
.nav-list > li > a,
.nav-list .nav-header {
margin-left: -15px;
margin-right: -15px;
text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.nav-list > li > a {
padding: 3px 15px;
}
.nav-list > .active > a,
.nav-list > .active > a:hover,
.nav-list > .active > a:focus {
color: @body-bg;
text-shadow: 0 -1px 0 rgba(0,0,0,.2);
background-color: @link-color;
}
.nav-list [class^="icon-"],
.nav-list [class*=" icon-"] {
margin-right: 2px;
}
// Dividers (basically an hr) within the dropdown
.nav-list .divider {
.nav-divider();
}
Run Code Online (Sandbox Code Playgroud)
生成的CSS是:
.nav-header {
display: block;
padding: 3px 15px;
font-size: 11px;
font-weight: bold;
line-height: 1.5;
color: #999999;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-transform: uppercase;
}
.nav li + .nav-header {
margin-top: 9px;
}
.nav-list {
padding-left: 15px;
padding-right: 15px;
margin-bottom: 0;
}
.nav-list > li > a,
.nav-list .nav-header {
margin-left: -15px;
margin-right: -15px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.nav-list > li > a {
padding: 3px 15px;
}
.nav-list > .active > a,
.nav-list > .active > a:hover,
.nav-list > .active > a:focus {
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
background-color: #428bca;
}
.nav-list [class^="icon-"],
.nav-list [class*=" icon-"] {
margin-right: 2px;
}
.nav-list .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
Run Code Online (Sandbox Code Playgroud)
在正常引导资产之后包括CSS或LESS.