I'm struggling to achieve a border color change effect on hover for Bootstrap cards.
<b-card no-body class="my-card border">
<button>Click here</button>
<b-collapse>
<b-card-body>
<b-card-text>text here</b-card-text>
</b-card-body>
</b-collapse>
<b-card>
I attempted to modify the b-card border color using a CSS class I created, however, it did not yield the desired result.
.my-card:hover {
border-color:#3E7DC0;
}
I also tried an alternative approach (unsure if correct), which also proved unsuccessful.
b-card:hover {
border-color:#3E7DC0;
}
Any suggestions on how to resolve this issue? Thank you in advance.
edit: I aim for my card to have a grey border that transitions to blue when hovered over. The reason why the hover effect isn't working might be due to the presence of the border class in this line of code
<b-card no-body class="my-card border">
Removing border
allows the hover effect to work, but eliminates the initial border.
update:
I managed to address the problem by incorporating !important
like so
b-card:hover {
border: 1px solid #3E7DC0 !important;
}
However, I understand that relying on !important
is not recommended. Are there any other solutions available?