Skip to content

Commit ed9529b

Browse files
committed
tweak cards css
- no need for .card-title - link border-radius values
1 parent 2c9cda1 commit ed9529b

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎scss/_card.scss‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ $card-tokens: defaults(
1616
--card-subtitle-color: inherit,
1717
--card-border-width: var(--border-width),
1818
--card-border-color: var(--border-color-translucent),
19-
--card-border-radius: var(--radius-7),
19+
--card-border-radius: var(--radius-8),
2020
--card-box-shadow: none,
21-
--card-inner-border-radius: calc(var(--radius-7) - var(--border-width)),
21+
--card-inner-border-radius: calc(var(--card-border-radius) - var(--border-width)),
2222
--card-cap-padding-y: var(--spacer-3),
2323
--card-cap-padding-x: var(--spacer),
2424
--card-cap-bg: var(--bg-1),
@@ -99,12 +99,6 @@ $card-tokens: defaults(
9999
}
100100
}
101101

102-
.card-title,
103-
.card-subtitle,
104-
.card-text {
105-
align-self: stretch;
106-
}
107-
108102
.card-subtitle {
109103
margin-top: calc(var(--card-body-gap) * -.5);
110104
}
@@ -195,12 +189,14 @@ $card-tokens: defaults(
195189
outline-offset: calc(var(--card-border-width) * -1);
196190
}
197191

198-
.card-img,
192+
.card-img {
193+
@include border-radius(var(--radius-5));
194+
}
195+
199196
.card-img-top {
200197
@include border-top-radius(var(--card-inner-border-radius));
201198
}
202199

203-
.card-img,
204200
.card-img-bottom {
205201
@include border-bottom-radius(var(--card-inner-border-radius));
206202
}

‎site/src/content/docs/components/card.mdx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ Titles, text, and links within cards all have required class names for managing
7474

7575
### Images
7676

77+
Place images anywhere in a card and style as you like.
78+
79+
<Example code={`<div class="card" style="width: 18rem;">
80+
<div class="card-body">
81+
<Placeholder width="100%" text="Image cap" class="card-img" />
82+
<h5 class="mt-2 mb-0">Image within the body</h5>
83+
<p class="card-text fg-2">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
84+
<small class="fg-3">Last updated 3 mins ago</small>
85+
</div>
86+
</div>`} />
87+
7788
Use `.card-img-top` and `.card-img-bottom` to round the top and bottom corners of the image.
7889

7990
<Example class="d-flex gap-3 flex-wrap" code={`<div class="card" style="width: 18rem;">

0 commit comments

Comments
 (0)