{"id":13772375,"url":"https://github.com/csswizardry/csswizardry-grids","last_synced_at":"2025-05-15T16:06:29.494Z","repository":{"id":6811342,"uuid":"8059275","full_name":"csswizardry/csswizardry-grids","owner":"csswizardry","description":"Simple, fluid, nestable, flexible, Sass-based, responsive grid system.","archived":false,"fork":false,"pushed_at":"2023-01-31T16:01:49.000Z","size":99,"stargazers_count":1493,"open_issues_count":45,"forks_count":201,"subscribers_count":78,"default_branch":"master","last_synced_at":"2025-04-06T18:15:36.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://csswizardry.com/csswizardry-grids","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csswizardry.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-06T20:23:12.000Z","updated_at":"2025-04-05T19:44:05.000Z","dependencies_parsed_at":"2023-02-17T21:40:13.541Z","dependency_job_id":null,"html_url":"https://github.com/csswizardry/csswizardry-grids","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csswizardry%2Fcsswizardry-grids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csswizardry%2Fcsswizardry-grids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csswizardry%2Fcsswizardry-grids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csswizardry%2Fcsswizardry-grids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csswizardry","download_url":"https://codeload.github.com/csswizardry/csswizardry-grids/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526764,"owners_count":20953143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:03.163Z","updated_at":"2025-04-07T21:14:14.838Z","avatar_url":"https://github.com/csswizardry.png","language":"CSS","funding_links":[],"categories":["Tools"],"sub_categories":["Layers"],"readme":"# csswizardry-grids\n\n**Simple, fluid, nestable, flexible, Sass-based, responsive grid system.**\n\n* Fully responsive\n* Mobile first\n* Infinitely nestable\n* Reversible/reorderable\n* With/without gutters\n* Endless possible combinations\n* Simple to understand, human-friendly classes\n* Option to keep classes out of your HTML\n* Robust\n* Simple\n* No `.clear` or `.last` classes\n* It just _works_\n\nPlease see [Responsive grid systems; a solution?](http://csswizardry.com/2013/02/responsive-grid-systems-a-solution/)\nfor a comprehensive overview of the principles of the grid system.\n\n## Demo\n\n* [csswizardry.github.com/csswizardry-grids](http://csswizardry.github.com/csswizardry-grids).\n* [Writeup](http://csswizardry.com/2013/02/introducing-csswizardry-grids/)\n\n## Setup\n\nSimply fill in/adjust the relevant variables.\n\n* `$responsive` is used to turn csswizardry-grids’ responsive features on and\n  off. csswizardry-grids is designed primarily for responsive builds but can\n  also be used on non-responsive projects just as easily. Setting this to false\n  will simply prevent Sass generating your `palm` etc modifiers.\n* `$gutter` controls how much space there is between columns.\n* `$mobile-first` controls whether you would like unclassed grid items to\n  _initially_ adopt `width:100%;. This means that you won’t need to add a class\n  to force a grid item to take up the full width of its container.\n* `$use-silent-classes` tells csswizardry-grids whether to go ahead and compile\n  solid, traditional classes (e.g. `.one-whole`) or to create Sass ‘silent’\n  classes which only compile to CSS once explictly called.\n* `$lap-start` and `$desk-start` tell csswizardry-grids when to fire particular\n  media queries to service those particular sizes. Note that csswizardry-grids\n  works out the ends of any other breakpoints by using these numbers.\n\n## Usage\n\ncsswizardry-grids is incredibly simple to implement, its classes are all\nhuman-readable and follow the same pattern.\n\n### Patterns\n\ncsswizardry-grids’ classes are based on [a modified BEM\nsyntax](http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/).\n\n* `.grid` is a **B**lock\n* `.grid__item` is an **E**lement\n* `.grid--rev` is a **M**odifier\n\nClasses include your breakpoint namespaces (e.g. `.palm--one-half`,\n`.desk--two-thirds` and so on); your push and pull classes (`.push--one-third`,\n`.pull--desk--one-quarter` and so on); your regular classes (`.one-tenth`,\n`.three-quarters` etc).\n\nKnowing these patterns will allow you to create hundreds of different\ncombinations. A few examples:\n\n    /**\n     * Sets an item to be one half across all breakpoints.\n     */\n    .one-half{}\n\n    /**\n     * Pushes an item one third of the way to the right across all breakpoints.\n     */\n    .push--one-third{}\n\n    /**\n     * Sets an item to be ten twelfths wide only at the desk breakpoint.\n     */\n    .desk--ten-twelthfs{}\n\n    /**\n     * Pulls an item one half of the way to the left only at the palm breakpoint.\n     */\n    .pull--palm--one-half{}\n\n### Classes in markup\n\nIf you are using traditional classes then an example, basic usage might look\nlike this:\n\n    \u003cdiv class=\"grid\"\u003e\n    \n        \u003cdiv class=\"grid__item  lap--one-half  desk--two-thirds\"\u003e\n            ...\n        \u003c/div\u003e\u003c!--\n    \n     --\u003e\u003cdiv class=\"grid__item  lap--one-half  desk--one-third\"\u003e\n            ...\n        \u003c/div\u003e\n    \n    \u003c/div\u003e\n\nIt’s as simple as that!\n\n---\n\n**Note the empty HTML comments.** These are to remove whitespace caused by using\n`inline-block`.  Prior to v1.1 this was tackled by using some\n[`[letter|word]-spacing` trickery](https://github.com/csswizardry/csswizardry-grids/blob/60a5075ac65282bb24fa5a5d5ed32a060ce2975f/csswizardry-grids.scss#L64-L65),\nhowever Chrome 25 introduced a change which meant this method now broke\ncsswizardry-grids.\n\nIf you’d rather not use HTML comments to remove the whitespace then you can set\nthe `$use-markup-fix` variable to false; this invokes a CSS hack that _cannot_\nbe guaranteed. Always take care to check things over if using this method.\n\nIf you need to use csswizardry-grids with a CMS, or data coming out of a loop,\nyou will need to format your template something a little like this:\n\n```php\n\u003cdiv class=\"grid\"\u003e\n\u003c!--\n\u003c?php\n    $items = array('foo', 'bar', 'baz');\n\n    foreach ($items as $item) {\n?\u003e\n\n--\u003e\u003cdiv class=\"grid__item  one-third\"\u003e\n    \u003c?= $item ?\u003e\n\u003c/div\u003e\u003c!--\n\n\u003c?php\n    }\n?\u003e\n--\u003e\n\u003c/div\u003e\n```\n\nNote the opening and closing comments before and after the loop, and the\ncorresponding opening and closing comments facing outward from the `.grid__item`\nelement. Try pasting the above into [the codepad\ncode runner](http://codepad.viper-7.com/): items from a loop without the need\nfor a counter :)\n\n---\n\n### Sass’ silent classes\n\nIf you are using silent classes (`$use-silent-classes: true;`) then your HTML\nmight look like this:\n\n    \u003cdiv class=\"page\"\u003e\n    \n        \u003cdiv class=\"content\"\u003e\n            ...\n        \u003c/div\u003e\u003c!--\n    \n     --\u003e\u003cdiv class=\"sub-content\"\u003e\n            ...\n        \u003c/div\u003e\n    \n    \u003c/div\u003e\n\n…and your Sass, something like this:\n\n    .page{\n        @extend %grid;\n    }\n    \n        .content,\n        .sub-content{\n            @extend %grid__item;\n            @extend %one-whole;\n            @extend %lap--one-half;\n        }\n    \n        .content{\n            @extend %desk--two-thirds;\n        }\n    \n        .sub-content{\n            @extend %desk--one-third;\n        }\n\n### Reversed grids (`.grid--rev{}`)\n\ncsswizardry-grids has the option to reverse a set of grids; this means that the\norder you write your source and the order it renders are total opposites, for\nexample:\n\n    \u003cdiv class=\"grid  grid--rev\"\u003e\n\n        \u003cdiv class=\"main-content  grid__item  two-thirds\"\u003e\n            I appear first in the markup, but render second in the page.\n        \u003c/div\u003e\u003c!--\n\n     --\u003e\u003cdiv class=\"sub-content  grid__item  one-third\"\u003e\n            I appear second in the markup, but render first in the page.\n        \u003c/div\u003e\n\n    \u003c/div\u003e\n\nThis is handy if you want to lay out your page a certain way visually but it\nwould be advantageous to order the source differently, for example to aid\naccessibility (getting a screenreader to read more important content first).\n\n### Gutterless grids (`.grid--full{}`)\n\nIt may be desirable at times to have no gutter between your grid items; with\ncsswizardry-grids this is as simple as:\n\n    \u003cdiv class=\"grid  grid--full\"\u003e\n\n        \u003cdiv class=\"grid__item  one-half\"\u003e\n            Look, ma! No gutter!\n        \u003c/div\u003e\u003c!--\n\n     --\u003e\u003cdiv class=\"grid__item  one-half\"\u003e\n            Look, ma! No gutter!\n        \u003c/div\u003e\n\n    \u003c/div\u003e\n\n### Right-aligned grids (`.grid--right{}`)\n\nKeep grids in their correct order, but have them flush right instead of left:\n\n    \u003cdiv class=\"grid  grid--right\"\u003e\n\n        \u003cdiv class=\"grid__item  one-quarter\"\u003e\n            I render first but start in the middle of the page.\n        \u003c/div\u003e\u003c!--\n\n     --\u003e\u003cdiv class=\"grid__item  one-quarter\"\u003e\n            I render second and appear at the very right edge of the page.\n        \u003c/div\u003e\n\n    \u003c/div\u003e\n\n### Centred grids (`.grid--center{}`)\n\nYou can centrally align your grids by simply using the `.grid--center` modifier:\n\n    \u003cdiv class=\"grid  grid--center\"\u003e\n\n        \u003cdiv class=\"grid__item  one-half\"\u003e\n            I’m in the middle!\n        \u003c/div\u003e\n\n    \u003c/div\u003e\n\n### Vertically aligned grids (`.grid--[middle|bottom]{}`)\n\nYou can vertically align your grids to each other by simply using the\n`.grid--[middle|bottom]` modifiers:\n\n    \u003cdiv class=\"grid  grid--middle\"\u003e\n\n        \u003cdiv class=\"grid__item  one-half\"\u003e\n            I’m in the middle!\n        \u003c/div\u003e\n\n        \u003cdiv class=\"grid__item  one-half\"\u003e\n            I’m in the middle!\n        \u003c/div\u003e\n\n    \u003c/div\u003e\n\n### Different sized grids (`.grid--[narrow|wide]{}`)\n\nYou can quickly alter the gutter size of your grids to half (`.grid--narrow`) or\ndouble (`.grid--wide`) by using the relevant modifiers.\n\n    \u003cdiv class=\"grid  grid--narrow\"\u003e\n\n        \u003cdiv class=\"grid__item  one-half\"\u003e\n            I’m a narrow-guttered grid.\n        \u003c/div\u003e\n\n        \u003cdiv class=\"grid__item  one-half\"\u003e\n            I’m a narrow-guttered grid.\n        \u003c/div\u003e\n\n    \u003c/div\u003e\n\n## Help and questions\n\nIf you have any trouble setting csswizardry-grids up, or would like some help\nusing and implementing it (or any questions about how it works) then please feel\nfree to [fire me a tweet](https://twitter.com/csswizardry) or\n[open an issue](https://github.com/csswizardry/csswizardry-grids/issues/new).\n\ncsswizardry-grids’ Sass can look a little daunting, but it’s doing quite a lot\nof work behind the scenes to make it as simple as possible when it comes to\nimplementation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsswizardry%2Fcsswizardry-grids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsswizardry%2Fcsswizardry-grids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsswizardry%2Fcsswizardry-grids/lists"}