0

I have to make a website using the Bootstrap 5 framework, so I've been messing around with "Bootstrap Cards". When I click on a card a border appears. Thought I might fix it overwriting it using the pseudo element :focus

.card:focus {outline: 0 !important;

E.g.:

enter image description here

I guess it's something else then an outline, but don't have the needed knowledge of HTML

desertnaut
  • 57,590
  • 26
  • 140
  • 166
lukramon
  • 43
  • 1
  • 8

3 Answers3

1

Check .card class has a border

To remove it simply override it to border: none;

0

Try using this code:

.card:focus {
   border: none !important;
}
desertnaut
  • 57,590
  • 26
  • 140
  • 166
LucasSaladini
  • 91
  • 1
  • 12
  • Also tried it. I found out the problem isn't situated at the Cards, but at the Scrollspy. Take a look here: gip.lukramon.com – lukramon Feb 17 '21 at 12:35
  • Yup, probably that. I took a look at the code and nothing on card class on the console. Did you fixed the problem? – LucasSaladini Feb 17 '21 at 12:46
0

Bootstrap 5 has a separate class border-0 for this.

Try running the code below with and without the border-0 class to see how it works.

More about borders in Bootstrap here. Hope this helps:)

<!--link to bootstrap 5 script and styles-->

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"/>

<!-- bootstrap 5 card with no borders without modifying your .css-->
<!--attention to the border-0 class below-->

<div class="card border-0"> 
  <div class="card-body">
    <h1 class="display-1">Card With No Borders!</h1>
    <p class="card-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed elementum dui arcu, eu aliquet odio elementum non. Curabitur vel mi ligula. In vel dolor diam. Curabitur ornare, magna eget ultrices luctus, magna lectus tempus dui, non facilisis elit dolor eu risus. </p>
    <a href="#" class="btn btn-primary">A Button</a>               
  </div>
</div>