]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Simplify list-group borders in cards (#30808)
authorMark Otto <markd.otto@gmail.com>
Thu, 14 May 2020 17:48:46 +0000 (10:48 -0700)
committerGitHub <noreply@github.com>
Thu, 14 May 2020 17:48:46 +0000 (19:48 +0200)
scss/_card.scss
site/content/docs/5.0/components/card.md

index 230ab113ab1eeb43e8cc66f22c79e4c2da27c861..a2407c8b0f20b4986f08d65037859df3be43e23e 100644 (file)
       @include border-bottom-radius($card-inner-border-radius);
     }
   }
+
+  // Due to specificity of the above selector (`.card > .list-group`), we must
+  // use a child selector here to prevent double borders.
+  > .card-header + .list-group,
+  > .list-group + .card-footer {
+    border-top: 0;
+  }
 }
 
 .card-body {
   &:first-child {
     @include border-radius($card-inner-border-radius $card-inner-border-radius 0 0);
   }
-
-  + .list-group {
-    .list-group-item:first-child {
-      border-top: 0;
-    }
-  }
 }
 
 .card-footer {
index 4bb116f0f9f48e4eb0536db2d522818774ca7ae1..3b250db735f34cadc3f7eb4fe06a89fe576414d3 100644 (file)
@@ -101,6 +101,19 @@ Create lists of content in a card with a flush list group.
 </div>
 {{< /example >}}
 
+{{< example >}}
+<div class="card" style="width: 18rem;">
+  <ul class="list-group list-group-flush">
+    <li class="list-group-item">Cras justo odio</li>
+    <li class="list-group-item">Dapibus ac facilisis in</li>
+    <li class="list-group-item">Vestibulum at eros</li>
+  </ul>
+  <div class="card-footer">
+    Card footer
+  </div>
+</div>
+{{< /example >}}
+
 ### Kitchen sink
 
 Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.