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

Setting a background on card-body covers the rounded corners on the bottom #37010

Open
3 tasks done
willywongi opened this issue Aug 23, 2022 · 4 comments · May be fixed by #37018
Open
3 tasks done

Setting a background on card-body covers the rounded corners on the bottom #37010

willywongi opened this issue Aug 23, 2022 · 4 comments · May be fixed by #37018

Comments

@willywongi
Copy link

Prerequisites

Describe the issue

If you set a background color (also with utilty classes) on the card-body element and you don't have any card-footer, the rounded corners of the bottom border are covered up by the angles of the card-body background. I think that the linked examples are clear.
The code in the example is a fork from the first example in the Card documentation page, so it should be really straightforward.

The problem can be resolved applying overflow: clip or overflow: hidden to the container element (the div.card); but I fear that could break other things. Maybe a better option should be to set a inner border radius as with the card-header and card-footer element?

Thank you for your time reading this. Ciao!

Reduced test cases

https://codepen.io/pongi/pen/PoRLrGq
https://stackblitz.com/edit/2mfdqf?file=index.html

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome, Safari, Firefox

What version of Bootstrap are you using?

v5.2.0

@louismaximepiton
Copy link
Member

louismaximepiton commented Aug 24, 2022

I can see a regression with your proposal, with for example dropdown inside the card (tried with .dropend on your example instead of the button). Still looking around for a solution !

@mdo
Copy link
Member

mdo commented Aug 24, 2022

If you move the .text-bg-success class up to the .card level, there's no issue.

@louismaximepiton
Copy link
Member

I think it would be more understandable, logical and practical for folks to write their utilities wherever they want.

For example in Background & color, if I want something like that:
image

  • Right now, if I don't wanna write some additional CSS, I need to set up the whole card in .text-bg-dark. Then I set the .card-header, that is particularly rounded in CSS, with .text-bg-primary. Then I'll need to change the border-color etc...

  • Right now, if I'm able to add some CSS, I need to add a border-radius to the .card-body if it is the :last-child and then add my utilities. If I only set my bg utility, I get:
    image

  • With the associated PR, it removes the distinction between classes to only have :first-child and :last-child and so they could use utilities with their wish.

@mdo
Copy link
Member

mdo commented Sep 1, 2022

That's helpful, thanks! I've slated this for v5.3.0 for now as we try to get v5.2.1 out the door :). I think this change would be more beneficial in that release instead of here as a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs review
Status: To do
Development

Successfully merging a pull request may close this issue.

4 participants