I’m trying to simulate twitter-bootstrap-3 .table-hover
and table-striped
on list-group
. First I have tried the following for hover:
<!-- HTML --!>
<ul class="list-group list-group-hover">
<li class="list-group-item">...
...
// CSS
ul.list-group.list-group-hover li:hover{
background: $table-bg-hover;
}
The above code works fine and it generates hover over each list’s item.
However, trying to add striped
like table as the following code, does not work, i.e the strip effect only works but the hover is not working.
<!-- HTML -->
<ul class="list-group list-group-hover list-group-striped">
...
// CSS
ul.list-group.list-group-hover li:hover{
background: $table-bg-hover;
}
ul.list-group.list-group-striped li:nth-of-type(odd){
background: $table-bg-accent;
}
ul.list-group.list-group-striped li:nth-of-type(even){
background: $body-bg;
}
I don’t know how could I make the two effects, hover and stripped, working at the same time as table do?
2
Answers
:hover
needs to come lastHere’s my solution, using the standard bootstrap 5 colours. Based on the official example.
You could tweak the stripe and hover colours.