Skip to content

Instantly share code, notes, and snippets.

@csswizardry
Created January 24, 2016 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csswizardry/aff459cf90a2a6c7b205 to your computer and use it in GitHub Desktop.
Save csswizardry/aff459cf90a2a6c7b205 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<p class="u-1/4
u-1/3@md
u-1/2@lg">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.
</p>
// ----
// libsass (v3.3.2)
// ----
/*------------------------------------*\
#WIDTHS
\*------------------------------------*/
// A mixin to spit out our width classes. Pass in the columns we want the widths
// to have, and an optional suffix for responsive widths. E.g. to create thirds
// and quarters for a small breakpoint:
//
// @include widths(3 4, -sm);
@mixin widths($widths-columns, $widths-breakpoint: null) {
// Loop through the number of columns for each denominator of our fractions.
@each $widths-denominator in $widths-columns {
// Begin creating a numberator for our fraction up until we hit the
// denominator.
@for $widths-numerator from 1 through $widths-denominator {
// Build a class in the format `.u-3/4` or `.u-3-of-4`.
.u-#{$widths-numerator}\/#{$widths-denominator}#{$widths-breakpoint} {
width: ($widths-numerator / $widths-denominator) * 100% !important;
}
}
}
}
/**
* A series of width helper classes that you can use to size things like grid
* systems. Classes can take a fraction-like format (e.g. `.u-2/3`) or a spoken-
* word format (e.g. `.u-2-of-3`). Use these in your markup:
*
* <div class="u-7/12">
*/
@include widths(1 2 3 4 5);
@media screen and (min-width: 480px) {
@include widths(1 2 3 4 5, \@sm);
}
@media screen and (min-width: 720px) {
@include widths(1 2 3 4 5, \@md);
}
@media screen and (min-width: 1024px) {
@include widths(1 2 3 4 5, \@lg);
}
/*------------------------------------* #WIDTHS
\*------------------------------------*/
/**
* A series of width helper classes that you can use to size things like grid
* systems. Classes can take a fraction-like format (e.g. `.u-2/3`) or a spoken-
* word format (e.g. `.u-2-of-3`). Use these in your markup:
*
* <div class="u-7/12">
*/
.u-1\/1 {
width: 100% !important;
}
.u-1\/2 {
width: 50% !important;
}
.u-2\/2 {
width: 100% !important;
}
.u-1\/3 {
width: 33.33333% !important;
}
.u-2\/3 {
width: 66.66667% !important;
}
.u-3\/3 {
width: 100% !important;
}
.u-1\/4 {
width: 25% !important;
}
.u-2\/4 {
width: 50% !important;
}
.u-3\/4 {
width: 75% !important;
}
.u-4\/4 {
width: 100% !important;
}
.u-1\/5 {
width: 20% !important;
}
.u-2\/5 {
width: 40% !important;
}
.u-3\/5 {
width: 60% !important;
}
.u-4\/5 {
width: 80% !important;
}
.u-5\/5 {
width: 100% !important;
}
@media screen and (min-width: 480px) {
.u-1\/1\@sm {
width: 100% !important;
}
.u-1\/2\@sm {
width: 50% !important;
}
.u-2\/2\@sm {
width: 100% !important;
}
.u-1\/3\@sm {
width: 33.33333% !important;
}
.u-2\/3\@sm {
width: 66.66667% !important;
}
.u-3\/3\@sm {
width: 100% !important;
}
.u-1\/4\@sm {
width: 25% !important;
}
.u-2\/4\@sm {
width: 50% !important;
}
.u-3\/4\@sm {
width: 75% !important;
}
.u-4\/4\@sm {
width: 100% !important;
}
.u-1\/5\@sm {
width: 20% !important;
}
.u-2\/5\@sm {
width: 40% !important;
}
.u-3\/5\@sm {
width: 60% !important;
}
.u-4\/5\@sm {
width: 80% !important;
}
.u-5\/5\@sm {
width: 100% !important;
}
}
@media screen and (min-width: 720px) {
.u-1\/1\@md {
width: 100% !important;
}
.u-1\/2\@md {
width: 50% !important;
}
.u-2\/2\@md {
width: 100% !important;
}
.u-1\/3\@md {
width: 33.33333% !important;
}
.u-2\/3\@md {
width: 66.66667% !important;
}
.u-3\/3\@md {
width: 100% !important;
}
.u-1\/4\@md {
width: 25% !important;
}
.u-2\/4\@md {
width: 50% !important;
}
.u-3\/4\@md {
width: 75% !important;
}
.u-4\/4\@md {
width: 100% !important;
}
.u-1\/5\@md {
width: 20% !important;
}
.u-2\/5\@md {
width: 40% !important;
}
.u-3\/5\@md {
width: 60% !important;
}
.u-4\/5\@md {
width: 80% !important;
}
.u-5\/5\@md {
width: 100% !important;
}
}
@media screen and (min-width: 1200px) {
.u-1\/1\@lg {
width: 100% !important;
}
.u-1\/2\@lg {
width: 50% !important;
}
.u-2\/2\@lg {
width: 100% !important;
}
.u-1\/3\@lg {
width: 33.33333% !important;
}
.u-2\/3\@lg {
width: 66.66667% !important;
}
.u-3\/3\@lg {
width: 100% !important;
}
.u-1\/4\@lg {
width: 25% !important;
}
.u-2\/4\@lg {
width: 50% !important;
}
.u-3\/4\@lg {
width: 75% !important;
}
.u-4\/4\@lg {
width: 100% !important;
}
.u-1\/5\@lg {
width: 20% !important;
}
.u-2\/5\@lg {
width: 40% !important;
}
.u-3\/5\@lg {
width: 60% !important;
}
.u-4\/5\@lg {
width: 80% !important;
}
.u-5\/5\@lg {
width: 100% !important;
}
}
<p class="u-1/4
u-1/3@md
u-1/2@lg">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment