Created by: goulvench
List-groups can either contain <li class="list-group-item">
or links, but not both.
The proposed change allows using either text or links in a <ul class="list-group">
, by moving padding from the containing <li class="list-group-item">
to the contained <a class="list-group-item-action">
when it is the only direct child.
This allows the following HTML to display nicely:
<ul class="list-group">
<li class="list-group-item">Some text here</li>
<li class="list-group-item">
<a href="#" class="list-group-item-action">A link that spans the entire `<li>`</a>
</li>
</ul>
I'm using this in a project, and thought it might serve others as well.
Any improvement to make? For instance, I'm wondering if the :only-child
selector covers all likely use cases.
As an aside, this would help with issue #21755 (closed)