Skip to content

Instantly share code, notes, and snippets.

@tilomitra
Created September 26, 2013 23:51
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 tilomitra/6722246 to your computer and use it in GitHub Desktop.
Save tilomitra/6722246 to your computer and use it in GitHub Desktop.
A mobile-first grid for Pure. This pull request has more information on how to use it. Ping me if you run into issues. This is BETA! https://github.com/yui/pure/pull/146
.pure-g {
letter-spacing: -0.31em; /* Webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
*word-spacing: -0.43em; /* IE < 8: collapse white-space between units */
text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */
/*
Sets the font stack to fonts known to work properly with the above letter
and word spacings. See: https://github.com/yui/pure/issues/41/
The following font stack makes Pure Grids work on all known environments.
* FreeSans: Ships with many Linux distros, including Ubuntu
* Arimo: Ships with Chrome OS. Arimo has to be defined before Helvetica and
Arial to get picked up by the browser, even though neither is available
in Chrome OS.
* Droid Sans: Ships with all versions of Android.
* Helvetica, Arial, sans-serif: Common font stack on OS X and Windows.
*/
font-family: FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif;
/*
Use flexbox when possible to avoid `letter-spacing` side-effects.
NOTE: Firefox (as of 25) does not currently support flex-wrap, so the
`-moz-` prefix version is omitted.
*/
display: -webkit-flex;
-webkit-flex-flow: row wrap;
/* IE10 uses display: flexbox */
display: -ms-flexbox;
-ms-flex-flow: row wrap;
}
/* Opera as of 12 on Windows needs word-spacing.
The ".opera-only" selector is used to prevent actual prefocus styling
and is not required in markup.
*/
.opera-only :-o-prefocus,
.pure-g {
word-spacing: -0.43em;
}
/*
Resets the font family back to the OS/browser's default sans-serif font,
this the same font stack that Normalize.css sets for the `body`.
*/
.pure-g [class *= "pure-u"] {
font-family: sans-serif;
}
.unit {
display: inline-block;
*display: inline; /* IE < 8: fake inline-block */
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
font-size: 1rem;
*font-size: 14px;
}
.unit img {
max-width: 100%;
height: auto; /* preserves aspect ratio */
}
/*csslint duplicate-properties:false; */
.default-1 {
width: 100%;
*width: 99.969%; }
.default-1-2 {
width: 50%;
*width: 49.969%; }
.default-1-3 {
width: 33.33%;
*width: 33.299%; }
.default-2-3 {
width: 66.67%;
*width: 66.639%; }
.default-1-4 {
width: 25%;
*width: 24.969%; }
.default-3-4 {
width: 75%;
*width: 74.969%; }
.default-1-5 {
width: 20%;
*width: 19.969%; }
.default-2-5 {
width: 40%;
*width: 39.969%; }
.default-3-5 {
width: 60%;
*width: 59.969%; }
.default-4-5 {
width: 80%;
*width: 79.969%; }
.default-1-6 {
width: 16.66%;
*width: 16.629%; }
.default-5-6 {
width: 83.33%;
*width: 83.299%; }
.default-1-8 {
width: 12.5%;
*width: 12.469%; }
.default-3-8 {
width: 37.5%;
*width: 37.469%; }
.default-5-8 {
width: 62.5%;
*width: 62.469%; }
.default-7-8 {
width: 87.5%;
*width: 87.469%; }
.default-1-12 {
width: 8.33%;
*width: 8.299%; }
.default-5-12 {
width: 41.67%;
*width: 41.639%; }
.default-7-12 {
width: 58.33%;
*width: 58.299%; }
.default-11-12 {
width: 91.67%;
*width: 91.639%; }
.default-1-24 {
width: 4.17%;
*width: 4.139%; }
.default-5-24 {
width: 20.83%;
*width: 20.799%; }
.default-7-24 {
width: 29.17%;
*width: 29.139%; }
.default-11-24 {
width: 45.83%;
*width: 45.799%; }
.default-13-24 {
width: 54.17%;
*width: 54.139%; }
.default-17-24 {
width: 70.83%;
*width: 70.799%; }
.default-19-24 {
width: 79.17%;
*width: 79.139%; }
.default-23-24 {
width: 95.83%;
*width: 95.799%; }
/*csslint regex-selectors:false, unqualified-attributes:false*/
/*
* Right after 480px, the tablet rules kick in,
* forcing the elements to update to these widths,
* as they take precedence over default-* rules.
*
* There is no upper-limit on the width set here. This
* allows the user to not specify a desktop-* rule
* unless they explicitly want something different
* to happen.
*/
@media (min-width: 480px) {
.tablet-1 {
width: 100%; }
.tablet-1-2 {
width: 50%; }
.tablet-1-3 {
width: 33.33%; }
.tablet-2-3 {
width: 66.67%; }
.tablet-1-4 {
width: 25%; }
.tablet-3-4 {
width: 75%; }
.tablet-1-5 {
width: 20%; }
.tablet-2-5 {
width: 40%; }
.tablet-3-5 {
width: 60%; }
.tablet-4-5 {
width: 80%; }
.tablet-1-6 {
width: 16.66%; }
.tablet-5-6 {
width: 83.33%; }
.tablet-1-8 {
width: 12.5%; }
.tablet-3-8 {
width: 37.5%; }
.tablet-5-8 {
width: 62.5%; }
.tablet-7-8 {
width: 87.5%; }
.tablet-1-12 {
width: 8.33%; }
.tablet-5-12 {
width: 41.67%; }
.tablet-7-12 {
width: 58.33%; }
.tablet-11-12 {
width: 91.67%; }
.tablet-1-24 {
width: 4.17%; }
.tablet-5-24 {
width: 20.83%; }
.tablet-7-24 {
width: 29.17%; }
.tablet-11-24 {
width: 45.83%; }
.tablet-13-24 {
width: 54.17%; }
.tablet-17-24 {
width: 70.83%; }
.tablet-19-24 {
width: 79.17%; }
.tablet-23-24 {
width: 95.83%; } }
/*
* Right after 980px, the desktop rules kick in,
* forcing the elements to update to these widths,
* as they take precedence over default-* rules.
*/
@media (min-width: 980px) {
.desktop-1 {
width: 100%; }
.desktop-1-2 {
width: 50%; }
.desktop-1-3 {
width: 33.33%; }
.desktop-2-3 {
width: 66.67%; }
.desktop-1-4 {
width: 25%; }
.desktop-3-4 {
width: 75%; }
.desktop-1-5 {
width: 20%; }
.desktop-2-5 {
width: 40%; }
.desktop-3-5 {
width: 60%; }
.desktop-4-5 {
width: 80%; }
.desktop-1-6 {
width: 16.66%; }
.desktop-5-6 {
width: 83.33%; }
.desktop-1-8 {
width: 12.5%; }
.desktop-3-8 {
width: 37.5%; }
.desktop-5-8 {
width: 62.5%; }
.desktop-7-8 {
width: 87.5%; }
.desktop-1-12 {
width: 8.33%; }
.desktop-5-12 {
width: 41.67%; }
.desktop-7-12 {
width: 58.33%; }
.desktop-11-12 {
width: 91.67%; }
.desktop-1-24 {
width: 4.17%; }
.desktop-5-24 {
width: 20.83%; }
.desktop-7-24 {
width: 29.17%; }
.desktop-11-24 {
width: 45.83%; }
.desktop-13-24 {
width: 54.17%; }
.desktop-17-24 {
width: 70.83%; }
.desktop-19-24 {
width: 79.17%; }
.desktop-23-24 {
width: 95.83%; } }
@media (max-width: 767px) {
.pure-hidden-phone {
display: none; }
.pure-visible-desktop {
display: none; } }
@media (min-width: 768px) and (max-width: 979px) {
.pure-hidden-tablet {
display: none; }
.pure-visible-desktop {
display: none; } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment