Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify list-group borders in cards #30808

Merged
merged 2 commits into from May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -80,12 +87,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
13 changes: 13 additions & 0 deletions site/content/docs/5.0/components/card.md
Expand Up @@ -101,6 +101,19 @@ Create lists of content in a card with a flush list group.
</div>
{{< /example >}}

{{< 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>
{{< /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