Last active
August 29, 2015 14:20
-
-
Save airen/8e46b4c77f454e0c1cac to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
<ul> | |
<li>Tab1</li> | |
<li>Tab2</li> | |
<li>Tab3</li> | |
<li>Tab4</li> | |
</ul> | |
<div class="box"> | |
<span>Tab</span> | |
<span>Tab</span> | |
<span>Tab</span> | |
<span>Tab</span> | |
<span>Tab</span> | |
</div> |
This file contains hidden or 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.13) | |
// Compass (v1.0.3) | |
// ---- | |
%flexbox{ | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: flex; | |
} | |
%equalflex { | |
-webkit-box-flex: 1; | |
-webkit-flex: 1; | |
flex: 1; | |
text-align: center; | |
} | |
%table-layout{ | |
display: table; | |
table-layout: fixed; | |
width: 100%; | |
} | |
%table-cell{ | |
display: table-cell; | |
width: 1%; | |
text-align: center; | |
} | |
@mixin equal-parts($way:table,$children: li){ | |
@if $way == table { | |
@extend %table-layout; | |
$childrenEle: li div p a span strong; | |
@if index($childrenEle, $children) { | |
#{$children} { | |
@extend %table-cell; | |
} | |
} | |
@else { | |
.#{$children} { | |
@extend %table-cell; | |
} | |
} | |
} | |
@else if $way == flex { | |
@extend %flexbox; | |
$childrenEle: li div p a span strong; | |
@if index($childrenEle, $children) { | |
#{$children} { | |
@extend %equalflex; | |
} | |
} | |
@else { | |
.#{$children} { | |
@extend %equalflex; | |
} | |
} | |
} | |
@else { | |
@warn "You have to put #{$way} value is set to the table or flex! " | |
} | |
} | |
ul { | |
@include equal-parts; | |
list-style: none outside none; | |
margin: 0 0 20px; | |
padding: 0; | |
} | |
.box { | |
@include equal-parts(flex,span); | |
} | |
This file contains hidden or 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
.box { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: flex; | |
} | |
.box span { | |
-webkit-box-flex: 1; | |
-webkit-flex: 1; | |
flex: 1; | |
text-align: center; | |
} | |
ul { | |
display: table; | |
table-layout: fixed; | |
width: 100%; | |
} | |
ul li { | |
display: table-cell; | |
width: 1%; | |
text-align: center; | |
} | |
ul { | |
list-style: none outside none; | |
margin: 0 0 20px; | |
padding: 0; | |
} |
This file contains hidden or 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
<ul> | |
<li>Tab1</li> | |
<li>Tab2</li> | |
<li>Tab3</li> | |
<li>Tab4</li> | |
</ul> | |
<div class="box"> | |
<span>Tab</span> | |
<span>Tab</span> | |
<span>Tab</span> | |
<span>Tab</span> | |
<span>Tab</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment