Skip to content

Commit ca6652c

Browse files
committed
update docs markdown
1 parent 6386f12 commit ca6652c

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

src/material/card/card.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,55 @@
22

33
<!-- example(card-overview) -->
44

5-
65
### Basic card sections
7-
The most basic card needs only an `<mat-card>` element with some content. However, Angular Material
8-
provides a number of preset sections that you can use inside of an `<mat-card>`:
96

7+
The most basic card needs only an `<mat-card>` element with some content. However, Angular Material
8+
provides a number of preset sections that you can use inside a `<mat-card>`:
109

11-
| Element | Description |
12-
| ---------------------- | ------------------------------------------------------ |
13-
| `<mat-card-title>` | Card title |
14-
| `<mat-card-subtitle>` | Card subtitle |
15-
| `<mat-card-content>` | Primary card content. Intended for blocks of text |
16-
| `<img mat-card-image>` | Card image. Stretches the image to the container width |
17-
| `<mat-card-actions>` | Container for buttons at the bottom of the card |
18-
| `<mat-card-footer>` | Section anchored to the bottom of the card |
10+
| Element | Description |
11+
|--------------------------|----------------------------------------------------------------|
12+
| `<mat-card-header>` | Section anchored to the top of the card (adds padding) |
13+
| `<mat-card-content>` | Primary card content (adds padding) |
14+
| `<img mat-card-image>` | Card image. Stretches the image to the container width |
15+
| `<mat-card-actions>` | Container for buttons at the bottom of the card (adds padding) |
16+
| `<mat-card-footer>` | Section anchored to the bottom of the card |
1917

2018
These elements primary serve as pre-styled content containers without any additional APIs.
2119
However, the `align` property on `<mat-card-actions>` can be used to position the actions at the
22-
`'start'` or `'end'` of the container.
20+
`'start'` or `'end'` of the container.
21+
22+
### Card padding
2323

24+
The `<mat-card>` element itself does not add any padding around its content. This allows developers
25+
to customize the padding to their liking by applying padding to the elements they put in the card.
26+
27+
In many cases developers may just want the standard padding specified in the Material Design spec.
28+
In this case, the `<mat-card-header>`, `<mat-card-content>`, and `<mat-card-footer>` sections can be
29+
used.
30+
31+
* `<mat-card-content>` adds standard padding along its sides, as well as along the top if it is the
32+
first element in the `<mat-card>`, and along the bottom if it is the last element in the
33+
`<mat-card>`.
34+
* `<mat-card-header>` adds standard padding along its sides and top.
35+
* `<mat-card-actions>` adds padding appropriate for the action buttons at the bottom of a card.
2436

2537
### Card headers
26-
In addition to the aforementioned sections, `<mat-card-header>` gives the ability to add a rich
27-
header to a card. This header can contain:
2838

29-
| Element | Description |
30-
| ----------------------- | -------------------------------------------- |
31-
| `<mat-card-title>` | A title within the header |
32-
| `<mat-card-subtitle>` | A subtitle within the header |
33-
| `<img mat-card-avatar>` | An image used as an avatar within the header |
39+
A `<mat-card-header>` can contain any content, but there are several predefined elements
40+
that can be used to create a rich header to a card. These include:
3441

42+
| Element | Description |
43+
|--------------------------|------------------------------------------------------|
44+
| `<mat-card-title>` | A title within the header |
45+
| `<mat-card-subtitle>` | A subtitle within the header |
46+
| `<img mat-card-avatar>` | An image used as an avatar within the header |
47+
48+
In addition to using `<mat-card-title>` and `<mat-card-subtitle>` directly within the
49+
`<mat-card-header>`, they can be further nested inside a `<mat-card-title-group>` in order arrange
50+
them with a (non-avatar) image.
3551

3652
### Title groups
53+
3754
`<mat-card-title-group>` can be used to combine a title, subtitle, and image into a single section.
3855
This element can contain:
3956
* `<mat-card-title>`

0 commit comments

Comments
 (0)