mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 13:38:26 +01:00
Contextual list group cleanup
* Adds nav link to sidebar for contextual classes * Refactors to use prefixed classes, like .list-group-item-info, instead of chained classes * Adds default and linked variations to example in docs
This commit is contained in:
parent
693915d127
commit
07de53c644
@ -121,6 +121,7 @@
|
||||
<li><a href="#list-group-basic">Basic example</a></li>
|
||||
<li><a href="#list-group-badges">Badges</a></li>
|
||||
<li><a href="#list-group-linked">Linked items</a></li>
|
||||
<li><a href="#list-group-contextual-classes">Contextual classes</a></li>
|
||||
<li><a href="#list-group-custom-content">Custom content</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -3328,23 +3328,39 @@ body { padding-bottom: 70px; }
|
||||
{% endhighlight %}
|
||||
|
||||
<h3 id="list-group-contextual-classes">Contextual classes</h3>
|
||||
<p>Use contextual classes to color list items.</p>
|
||||
<p>Use contextual classes to style list items, default or linked. Also includes <code>.active</code> state.</p>
|
||||
<div class="bs-example">
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item">Cras justo odio</a>
|
||||
<a href="#" class="list-group-item success">Dapibus ac facilisis in</a>
|
||||
<a href="#" class="list-group-item">Morbi leo risus</a>
|
||||
<a href="#" class="list-group-item warning">Porta ac consectetur ac</a>
|
||||
<a href="#" class="list-group-item danger">Vestibulum at eros</a>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item list-group-item-success">Dapibus ac facilisis in</li>
|
||||
<li class="list-group-item list-group-item-warning">Porta ac consectetur ac</li>
|
||||
<li class="list-group-item list-group-item-danger">Vestibulum at eros</li>
|
||||
<li class="list-group-item list-group-item-info">Cras sit amet nibh libero</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item list-group-item-success">Dapibus ac facilisis in</a>
|
||||
<a href="#" class="list-group-item list-group-item-warning">Porta ac consectetur ac</a>
|
||||
<a href="#" class="list-group-item list-group-item-danger">Vestibulum at eros</a>
|
||||
<a href="#" class="list-group-item list-group-item-info">Cras sit amet nibh libero</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% highlight html %}
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item list-group-item-success">Dapibus ac facilisis in</li>
|
||||
<li class="list-group-item list-group-item-warning">Porta ac consectetur ac</li>
|
||||
<li class="list-group-item list-group-item-danger">Vestibulum at eros</li>
|
||||
<li class="list-group-item list-group-item-info">Cras sit amet nibh libero</li>
|
||||
</ul>
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item">Cras justo odio</a>
|
||||
<a href="#" class="list-group-item success">Dapibus ac facilisis in</a>
|
||||
<a href="#" class="list-group-item">Morbi leo risus</a>
|
||||
<a href="#" class="list-group-item warning">Porta ac consectetur ac</a>
|
||||
<a href="#" class="list-group-item danger">Vestibulum at eros</a>
|
||||
<a href="#" class="list-group-item list-group-item-success">Dapibus ac facilisis in</a>
|
||||
<a href="#" class="list-group-item list-group-item-warning">Porta ac consectetur ac</a>
|
||||
<a href="#" class="list-group-item list-group-item-danger">Vestibulum at eros</a>
|
||||
<a href="#" class="list-group-item list-group-item-info">Cras sit amet nibh libero</a>
|
||||
</div>
|
||||
{% endhighlight %}
|
||||
|
||||
|
138
dist/css/bootstrap.css
vendored
138
dist/css/bootstrap.css
vendored
@ -5511,36 +5511,6 @@ a.thumbnail.active {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.list-group-item.success {
|
||||
background-color: #dff0d8;
|
||||
border-color: #d6e9c6;
|
||||
}
|
||||
|
||||
.list-group-item.success:hover {
|
||||
background-color: #d0e9c6;
|
||||
border-color: #c9e2b3;
|
||||
}
|
||||
|
||||
.list-group-item.danger {
|
||||
background-color: #f2dede;
|
||||
border-color: #ebccd1;
|
||||
}
|
||||
|
||||
.list-group-item.danger:hover {
|
||||
background-color: #ebcccc;
|
||||
border-color: #e4b9c0;
|
||||
}
|
||||
|
||||
.list-group-item.warning {
|
||||
background-color: #fcf8e3;
|
||||
border-color: #faebcc;
|
||||
}
|
||||
|
||||
.list-group-item.warning:hover {
|
||||
background-color: #faf2cc;
|
||||
border-color: #f7e1b5;
|
||||
}
|
||||
|
||||
a.list-group-item {
|
||||
color: #555555;
|
||||
}
|
||||
@ -5576,6 +5546,114 @@ a.list-group-item.active:focus .list-group-item-text {
|
||||
color: #e1edf7;
|
||||
}
|
||||
|
||||
.list-group-item-success {
|
||||
color: #468847;
|
||||
background-color: #dff0d8;
|
||||
}
|
||||
|
||||
a.list-group-item-success {
|
||||
color: #468847;
|
||||
}
|
||||
|
||||
a.list-group-item-success .list-group-item-heading {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a.list-group-item-success:hover,
|
||||
a.list-group-item-success:focus {
|
||||
color: #468847;
|
||||
background-color: #d0e9c6;
|
||||
}
|
||||
|
||||
a.list-group-item-success.active,
|
||||
a.list-group-item-success.active:hover,
|
||||
a.list-group-item-success.active:focus {
|
||||
color: #fff;
|
||||
background-color: #468847;
|
||||
border-color: #468847;
|
||||
}
|
||||
|
||||
.list-group-item-warning {
|
||||
color: #c09853;
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
|
||||
a.list-group-item-warning {
|
||||
color: #c09853;
|
||||
}
|
||||
|
||||
a.list-group-item-warning .list-group-item-heading {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a.list-group-item-warning:hover,
|
||||
a.list-group-item-warning:focus {
|
||||
color: #c09853;
|
||||
background-color: #faf2cc;
|
||||
}
|
||||
|
||||
a.list-group-item-warning.active,
|
||||
a.list-group-item-warning.active:hover,
|
||||
a.list-group-item-warning.active:focus {
|
||||
color: #fff;
|
||||
background-color: #c09853;
|
||||
border-color: #c09853;
|
||||
}
|
||||
|
||||
.list-group-item-danger {
|
||||
color: #b94a48;
|
||||
background-color: #f2dede;
|
||||
}
|
||||
|
||||
a.list-group-item-danger {
|
||||
color: #b94a48;
|
||||
}
|
||||
|
||||
a.list-group-item-danger .list-group-item-heading {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a.list-group-item-danger:hover,
|
||||
a.list-group-item-danger:focus {
|
||||
color: #b94a48;
|
||||
background-color: #ebcccc;
|
||||
}
|
||||
|
||||
a.list-group-item-danger.active,
|
||||
a.list-group-item-danger.active:hover,
|
||||
a.list-group-item-danger.active:focus {
|
||||
color: #fff;
|
||||
background-color: #b94a48;
|
||||
border-color: #b94a48;
|
||||
}
|
||||
|
||||
.list-group-item-info {
|
||||
color: #3a87ad;
|
||||
background-color: #d9edf7;
|
||||
}
|
||||
|
||||
a.list-group-item-info {
|
||||
color: #3a87ad;
|
||||
}
|
||||
|
||||
a.list-group-item-info .list-group-item-heading {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
a.list-group-item-info:hover,
|
||||
a.list-group-item-info:focus {
|
||||
color: #3a87ad;
|
||||
background-color: #c4e3f3;
|
||||
}
|
||||
|
||||
a.list-group-item-info.active,
|
||||
a.list-group-item-info.active:hover,
|
||||
a.list-group-item-info.active:focus {
|
||||
color: #fff;
|
||||
background-color: #3a87ad;
|
||||
border-color: #3a87ad;
|
||||
}
|
||||
|
||||
.list-group-item-heading {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
|
2
dist/css/bootstrap.min.css
vendored
2
dist/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -2,17 +2,21 @@
|
||||
// List groups
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
// Base class
|
||||
//
|
||||
// Easily usable on <ul>, <ol>, or <div>.
|
||||
|
||||
.list-group {
|
||||
// No need to set list-style: none; since .list-group-item is block level
|
||||
margin-bottom: 20px;
|
||||
padding-left: 0; // reset padding because ul and ol
|
||||
}
|
||||
|
||||
|
||||
// Individual list items
|
||||
// -------------------------
|
||||
//
|
||||
// Use on `li`s or `div`s within the `.list-group` parent.
|
||||
|
||||
.list-group-item {
|
||||
position: relative;
|
||||
@ -41,12 +45,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Contextual variants
|
||||
.list-group-item-variant(success; @state-success-bg; @state-success-border);
|
||||
.list-group-item-variant(danger; @state-danger-bg; @state-danger-border);
|
||||
.list-group-item-variant(warning; @state-warning-bg; @state-warning-border);
|
||||
|
||||
// Linked list items
|
||||
//
|
||||
// Use anchor elements instead of `li`s or `div`s to create linked list items.
|
||||
// Includes an extra `.active` modifier class for showing selected items.
|
||||
|
||||
a.list-group-item {
|
||||
color: @list-group-link-color;
|
||||
|
||||
@ -80,8 +84,21 @@ a.list-group-item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Contextual variants
|
||||
//
|
||||
// Add modifier classes to change text and background color on individual items.
|
||||
// Organizationally, this must come after the `:hover` states.
|
||||
|
||||
.list-group-item-variant(success; @state-success-bg; @state-success-text);
|
||||
.list-group-item-variant(warning; @state-warning-bg; @state-warning-text);
|
||||
.list-group-item-variant(danger; @state-danger-bg; @state-danger-text);
|
||||
.list-group-item-variant(info; @state-info-bg; @state-info-text);
|
||||
|
||||
|
||||
// Custom content options
|
||||
// -------------------------
|
||||
//
|
||||
// Extra classes for creating well-formatted content within `.list-group-item`s.
|
||||
|
||||
.list-group-item-heading {
|
||||
margin-top: 0;
|
||||
|
@ -450,16 +450,28 @@
|
||||
|
||||
// List Groups
|
||||
// -------------------------
|
||||
.list-group-item-variant(@state; @background; @border) {
|
||||
.list-group-item.@{state} {
|
||||
.list-group-item-variant(@state; @background; @color) {
|
||||
.list-group-item-@{state} {
|
||||
color: @color;
|
||||
background-color: @background;
|
||||
border-color: @border;
|
||||
}
|
||||
a.list-group-item-@{state} {
|
||||
color: @color;
|
||||
|
||||
// Hover states
|
||||
.list-group-item.@{state}:hover {
|
||||
background-color: darken(@background, 5%);
|
||||
border-color: darken(@border, 5%);
|
||||
.list-group-item-heading { color: inherit; }
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: @color;
|
||||
background-color: darken(@background, 5%);
|
||||
}
|
||||
&.active,
|
||||
&.active:hover,
|
||||
&.active:focus {
|
||||
color: #fff;
|
||||
background-color: @color;
|
||||
border-color: @color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user