-
-
Save sickOscar/5961401 to your computer and use it in GitHub Desktop.
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
/* | |
_______ | |
These simple SCSS mixins for Foundation4 are made by me to deal with media-queries and have a clean code at the same time! ;) | |
****IMPORTANT**** | |
Due to Foundation 4 uses mobile-first methodology, every $phone-"X" variable in these mixins defines the value for every screen size. | |
$desktop-"X" values overrides $phone-"X" values when window width is 768px and above. | |
So, to simplify this, we can think that way: ($phone-"X" < 768px => $desktop-"X") | |
________ | |
*/ | |
/* | |
This mixin provides an easy way to use the F4 grid classes and media-queries. | |
$phone-grid: number of grid columns. | |
$desktop-grid: number of grid columns that overrides $phone-grid for window width 768px and above. | |
Only one parameter could be declared to define a value for every window width. | |
i.e.: | |
@include rgrid(3,6); => 3 columns for phone, 6 columns for desktop. | |
@inculde rgrid(6); => 6 columns. | |
*/ | |
@mixin rgrid($phone-grid:"",$desktop-grid:""){ | |
@extend .small-#{$phone-grid}; | |
@extend .large-#{$desktop-grid}; | |
@extend .columns; | |
} | |
/* | |
Define a font-size for both desktop and phone. | |
If only one parameter is declared, the phone font-size will be automatically defined 30% smaller than the desktop font-size) | |
i.e.: | |
@include rfont(24,12); => "font-size:24px" for desktop screens & "font-size:12px" for mobile. | |
@include rfont(20); => "font-size:20px" for desktop screens & "font-size:14px" for mobile. | |
*/ | |
@mixin rfont($desktop-font:"", $phone-font:$desktop-font*0.7){ | |
font-size: #{$phone-font}px; | |
@media #{$small}{font-size: #{$desktop-font}px;} | |
} | |
/* | |
Define any CSS property and their values for both desktop and phone. | |
i.e.: | |
@include rprop(margin-top,10px,20px); => "margin-top: 10px;" for mobile screens & "margin-top: 20px;" for desktop. | |
*/ | |
@mixin rprop($prop,$phone-value, $desktop-value){ | |
#{$prop}: $phone-value; | |
@media #{$small}{#{$prop}: $desktop-value;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment