Skip to content

Commit

Permalink
Fixes #5775: Collapse labels/badges
Browse files Browse the repository at this point in the history
* When :empty, display: none;
* Add documentation for change in behavior
  • Loading branch information
mdo committed Nov 3, 2012
1 parent fc42ac6 commit ead5dbe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/assets/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -5427,6 +5427,11 @@ a.thumbnail:hover {
border-radius: 9px;
}

.label:empty,
.badge:empty {
display: none;
}

a.label:hover,
a.badge:hover {
color: #ffffff;
Expand Down
3 changes: 3 additions & 0 deletions docs/components.html
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,9 @@ <h3>Badges</h3>
</tbody>
</table>

<h3>Easily collapsible</h3>
<p>For easy implementation, labels and badges will simply collapse (via CSS's <code>:empty</code> selector) when no content exists within.</p>

</section>


Expand Down
3 changes: 3 additions & 0 deletions docs/templates/pages/components.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -1788,6 +1788,9 @@
</tbody>
</table>

<h3>{{_i}}Easily collapsible{{/i}}</h3>
<p>{{_i}}For easy implementation, labels and badges will simply collapse (via CSS's <code>:empty</code> selector) when no content exists within.{{/i}}</p>

</section>


Expand Down
8 changes: 8 additions & 0 deletions less/labels-badges.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
.border-radius(9px);
}

// Empty labels/badges collapse
.label,
.badge {
&:empty {
display: none;
}
}

// Hover state, but only for links
a {
&.label:hover,
Expand Down

0 comments on commit ead5dbe

Please sign in to comment.