Skip to content

Commit

Permalink
Simplify list-group borders in cards (#30808)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo authored and XhmikosR committed Jun 4, 2020
1 parent 4e685e7 commit 233a659
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scss/_card.scss
Expand Up @@ -33,6 +33,13 @@
@include border-bottom-radius($card-inner-border-radius);
}
}

// Due to specificity of the above selector (`.card > .list-group`), we must
// use a child selector here to prevent double borders.
> .card-header + .list-group,
> .list-group + .card-footer {
border-top: 0;
}
}

.card-body {
Expand Down Expand Up @@ -83,12 +90,6 @@
&:first-child {
@include border-radius($card-inner-border-radius $card-inner-border-radius 0 0);
}

+ .list-group {
.list-group-item:first-child {
border-top: 0;
}
}
}

.card-footer {
Expand Down
14 changes: 14 additions & 0 deletions site/docs/4.5/components/card.md
Expand Up @@ -107,6 +107,20 @@ Create lists of content in a card with a flush list group.
{% endcapture %}
{% include example.html content=example %}

{% capture example %}
<div class="card" style="width: 18rem;">
<ul class="list-group list-group-flush">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
<div class="card-footer">
Card footer
</div>
</div>
{% endcapture %}
{% include example.html content=example %}

### Kitchen sink

Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.
Expand Down

0 comments on commit 233a659

Please sign in to comment.