Last active
January 15, 2017 16:00
-
-
Save jdlehman/b38aca96fc6024a28514 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 1% | |
last 2 versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="Table"> | |
<div class="Table-row Table-header"> | |
<div class="Table-row-item">Header1</div> | |
<div class="Table-row-item">Header2</div> | |
<div class="Table-row-item">Header3</div> | |
<div class="Table-row-item">Header4</div> | |
</div> | |
<div class="Table-row"> | |
<div class="Table-row-item" data-header="Header1">row1 col1</div> | |
<div class="Table-row-item" data-header="Header2">row1 col2</div> | |
<div class="Table-row-item" data-header="Header3">row1 col3</div> | |
<div class="Table-row-item" data-header="Header4">row1 col4</div> | |
</div> | |
<div class="Table-row"> | |
<div class="Table-row-item" data-header="Header1">row2 col1</div> | |
<div class="Table-row-item" data-header="Header2">row2 col2</div> | |
<div class="Table-row-item" data-header="Header3">row2 col3</div> | |
<div class="Table-row-item" data-header="Header4">row2 col4</div> | |
</div> | |
<div class="Table-row"> | |
<div class="Table-row-item" data-header="Header1">row3 col1</div> | |
<div class="Table-row-item" data-header="Header2">row3 col2</div> | |
<div class="Table-row-item" data-header="Header3">row3 col3</div> | |
<div class="Table-row-item" data-header="Header4">row3 col4</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// Breakpoint (v2.6.1) | |
// ---- | |
@import "breakpoint"; | |
.Table { | |
$light-color: #ffffff; | |
$dark-color: #f2f2f2; | |
$md: 500px; | |
display: flex; | |
flex-flow: column nowrap; | |
justify-content: space-between; | |
border: 1px solid $dark-color; | |
font-size: 1rem; | |
margin: 0.5rem; | |
line-height: 1.5; | |
// .Table-header | |
&-header { | |
display: none; | |
@include breakpoint($md) { | |
font-weight: 700; | |
background-color: $dark-color; | |
} | |
} | |
// .Table-row | |
&-row { | |
width: 100%; | |
&:nth-of-type(even) { background-color: $dark-color; } | |
&:nth-of-type(odd) { background-color: $light-color; } | |
@include breakpoint($md) { | |
display: flex; | |
flex-flow: row nowrap; | |
&:nth-of-type(even) { background-color: $light-color; } | |
&:nth-of-type(odd) { background-color: $dark-color; } | |
} | |
// .Table-row-item | |
&-item { | |
display: flex; | |
flex-flow: row nowrap; | |
flex-grow: 1; | |
flex-basis: 0; | |
padding: 0.5em; | |
word-break: break-word; | |
&:before { | |
content: attr(data-header); | |
width: 30%; | |
font-weight: 700; | |
} | |
@include breakpoint($md) { | |
border: 1px solid $light-color; | |
padding: 0.5em; | |
&:before { content: none; } | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.Table { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-flex-flow: column nowrap; | |
-ms-flex-flow: column nowrap; | |
flex-flow: column nowrap; | |
-webkit-box-pack: justify; | |
-webkit-justify-content: space-between; | |
-ms-flex-pack: justify; | |
justify-content: space-between; | |
border: 1px solid #f2f2f2; | |
font-size: 1rem; | |
margin: 0.5rem; | |
line-height: 1.5; | |
} | |
.Table-header { | |
display: none; | |
} | |
@media (min-width: 500px) { | |
.Table-header { | |
font-weight: 700; | |
background-color: #f2f2f2; | |
} | |
} | |
.Table-row { | |
width: 100%; | |
} | |
.Table-row:nth-of-type(even) { | |
background-color: #f2f2f2; | |
} | |
.Table-row:nth-of-type(odd) { | |
background-color: #ffffff; | |
} | |
@media (min-width: 500px) { | |
.Table-row { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-flex-flow: row nowrap; | |
-ms-flex-flow: row nowrap; | |
flex-flow: row nowrap; | |
} | |
.Table-row:nth-of-type(even) { | |
background-color: #ffffff; | |
} | |
.Table-row:nth-of-type(odd) { | |
background-color: #f2f2f2; | |
} | |
} | |
.Table-row-item { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-flex-flow: row nowrap; | |
-ms-flex-flow: row nowrap; | |
flex-flow: row nowrap; | |
-webkit-box-flex: 1; | |
-webkit-flex-grow: 1; | |
-ms-flex-positive: 1; | |
flex-grow: 1; | |
-webkit-flex-basis: 0; | |
-ms-flex-preferred-size: 0; | |
flex-basis: 0; | |
padding: 0.5em; | |
word-break: break-word; | |
} | |
.Table-row-item:before { | |
content: attr(data-header); | |
width: 30%; | |
font-weight: 700; | |
} | |
@media (min-width: 500px) { | |
.Table-row-item { | |
border: 1px solid #ffffff; | |
padding: 0.5em; | |
} | |
.Table-row-item:before { | |
content: none; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="Table"> | |
<div class="Table-row Table-header"> | |
<div class="Table-row-item">Header1</div> | |
<div class="Table-row-item">Header2</div> | |
<div class="Table-row-item">Header3</div> | |
<div class="Table-row-item">Header4</div> | |
</div> | |
<div class="Table-row"> | |
<div class="Table-row-item" data-header="Header1">row1 col1</div> | |
<div class="Table-row-item" data-header="Header2">row1 col2</div> | |
<div class="Table-row-item" data-header="Header3">row1 col3</div> | |
<div class="Table-row-item" data-header="Header4">row1 col4</div> | |
</div> | |
<div class="Table-row"> | |
<div class="Table-row-item" data-header="Header1">row2 col1</div> | |
<div class="Table-row-item" data-header="Header2">row2 col2</div> | |
<div class="Table-row-item" data-header="Header3">row2 col3</div> | |
<div class="Table-row-item" data-header="Header4">row2 col4</div> | |
</div> | |
<div class="Table-row"> | |
<div class="Table-row-item" data-header="Header1">row3 col1</div> | |
<div class="Table-row-item" data-header="Header2">row3 col2</div> | |
<div class="Table-row-item" data-header="Header3">row3 col3</div> | |
<div class="Table-row-item" data-header="Header4">row3 col4</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment