twbs / twbs/bootstrap

Incorrect borders with .list-group-flush.list-group-horizontal

Open
#39,150 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed css v5
Dominant language
MDX
Stars
175k
Forks
78.6k
Avg merge
7h 19m
Merged PRs (30d)
35

Description

Prerequisites
Describe the issue

When using .list-group-flush and .list-group-horizontal on the same list group you get:

Screenshot 2023-09-05 at 15 56 33

But was expecting:

Screenshot 2023-09-05 at 15 56 33 copy

Documentation seems to say that this is possible:

Add .list-group-flush to remove some borders and rounded corners to render list group items edge-to-edge in a parent container (e.g., cards).


I have seen another issue about putting a list group IN a list group. But that is not what is being reported here.


Workaround (how I made the second screenshot) is to add .border-0 on each .list-group-item

Reduced test cases
    <!-- a card with a link list group -->
    <div class="card" style="width: 18rem;">
      <div class="card-header">
        Featured
      </div>
      <div class="list-group list-group-flush list-group-horizontal">
        <a href="#" class="list-group-item list-group-item-action">Certificates</a>
        <a href="#" class="list-group-item list-group-item-action">Products</a>
        <a href="#" class="list-group-item list-group-item-action">AHA</a>
      </div>
    </div>

    <hr>

    <!-- a card with a link list group -->
    <div class="card" style="width: 18rem;">
      <div class="card-header">
        Featured
      </div>
      <div class="list-group list-group-flush list-group-horizontal">
        <a href="#" class="list-group-item list-group-item-action border-0">Certificates</a>
        <a href="#" class="list-group-item list-group-item-action border-0">Products</a>
        <a href="#" class="list-group-item list-group-item-action border-0">AHA</a>
      </div>
    </div>

Edit: CodePen created by @julien-deramond: https://codepen.io/julien-deramond/pen/rNoWJxg

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

macOS

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

Microsoft Edge

What version of Bootstrap are you using?

5.3.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reduced HTML test case or the linked CodePen, then trace the Bootstrap styles applied by .list-group-flush and .list-group-horizontal. Reproduce the border mismatch in Bootstrap 5.3.1 and verify that the combined classes render the expected borderless horizontal list without requiring .border-0 on each item.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, scss
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.