Skip to content

Instantly share code, notes, and snippets.

@rastislavcore
Created January 10, 2017 10:13
Show Gist options
  • Save rastislavcore/8814922f7ef5a0fa80905cf1c6e99a05 to your computer and use it in GitHub Desktop.
Save rastislavcore/8814922f7ef5a0fa80905cf1c6e99a05 to your computer and use it in GitHub Desktop.
Transform horizontal to vertical table
table {
display:block;
padding: 0px;
border-collapse:collapse;
border-spacing:0;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
thead {
display: block;
float: left;
margin: 0px;
padding: 0px;
width: 100px;
}
tbody {
margin: 0px;
padding: 0px;
}
tbody tr {
float:left;
}
th, td {
display:block;
padding: 5px;
margin: 0px;
}
thead > tr th:nth-child(odd) {
display:block;
float:left;
}
thead > tr th:nth-child(even) {
display:block;
float:left;
}
tbody > tr td:nth-child(odd) {
display:block;
}
tbody > tr td:nth-child(even) {
display:block;
float:right;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment