Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

".table-striped" class does not render a striped table #358

Closed
ift-jsy opened this issue Feb 23, 2015 · 1 comment
Closed

".table-striped" class does not render a striped table #358

ift-jsy opened this issue Feb 23, 2015 · 1 comment
Assignees

Comments

@ift-jsy
Copy link

ift-jsy commented Feb 23, 2015

Hello,

I just found out that the ".table-striped" have a wrong rendering:
table_striped

I supposed that the problem come for those two selectors:

table-striped>tbody>tr:nth-of-type(odd) {
background-color: #f9f9f9;
}

.table-striped>tbody>tr:nth-child(even)>td, .table-striped>tbody>tr:nth-child(even)>th {
background-color: #f9f9f9;
}

The first set a background for the odd rows and the second set a background for all the cells of the even rows which finally give a background for the whole table. Deactivating one of them fix the rendering:
table_striped_without_td
table_striped_without_tr

@tonifisler
Copy link
Contributor

The bug is happening because of this PR from Bootstrap: twbs/bootstrap#13920

We can resolve this by changing https://github.com/swiss/styleguide/blob/master/assets/sass/layout/tables.scss#L212-L230 to:

.table-striped {
  > tbody > tr:nth-of-type(odd) {
    background-color: transparent;
  }
  > tbody > tr:nth-of-type(even) {
    background-color: $table-bg-accent;
  }
  > thead td, > thead th, > tfoot td, > tfoot th {
    background: $smoke;
    font-weight: 700;
    color: $black;
  }
}

Use :nth-of-type to be consistent with a change from v3.3.2 regarding tooltips twbs/bootstrap#15551

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants