ionic-team / ionic-team/ionic-framework

bug: top padding incorrectly cleared on ion-card-content

Open
#24,808 3 comments 0 reactions 0 assignees View on GitHub
package: core type: bug
Dominant language
TypeScript
Stars
52.7k
Forks
13.3k
Avg merge
1d 15h
Merged PRs (30d)
51

Description

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

- [ ] v4.x
- [ ] v5.x
- [X] v6.x

### Current Behavior

When an `ion-card-content` immediately follows an `ion-card-header`, its `padding-top` is removed to avoid excess vertical space between the header text and content (via CSS in [card-content.md.scss](https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/card-content/card-content.md.scss#L48) and [card-content.ios.scss](https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/card-content/card-content.ios.scss#L45)).

This works well if both have the same background colour, but when one of them has its `Color` property set, the lack of padding between the content text and the coloured background looks wrong:

![image](https://user-images.githubusercontent.com/1843264/154475834-8a880940-cbe5-41b3-aa06-e1a7fde24c62.png)

### Expected Behavior

Ideally, leave the default padding if the background colour of the header and content are different:

![image](https://user-images.githubusercontent.com/1843264/154476373-4d82307d-af70-4b90-a3f3-0020cae7925f.png)

In practical terms, it would probably be acceptable if, say, the padding is only cleared if the header does not have its `color` attribute set, e.g.

``` css
ion-card-header:not([color]) + .card-content-ios {
padding-top: 0;
}
```

### Steps to Reproduce

Create a simple page with the following HTML:

``` html



Something Is Rotten


...in the state of Denmark!

```

### Code Reproduction URL

_No response_

### Ionic Info

Ionic:

Ionic CLI : 6.18.1 (C:\Users\David\AppData\Roaming\nvm\v16.13.0\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 6.0.5
@angular-devkit/build-angular : 13.2.2
@angular-devkit/schematics : 13.2.2
@angular/cli : 13.2.2
@ionic/angular-toolkit : 6.0.0

Capacitor:

Capacitor CLI : 3.4.0
@capacitor/android : 3.4.0
@capacitor/core : 3.4.0
@capacitor/ios : 3.4.0

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.1.0
OS : Windows 10

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.