Quick Reference
If you are familiar with mini.css and want a cheat sheet, you've come to the right place. Below you will find a quick overview of the toolkit and examples to help you brush up on your website-building skills. For more detailed instructions on modules, check out the modules page.
All examples showcased refer to the mini-default flavor, some class names and styles might differ based on the flavor you're using.
Setup & usage
You can import the default flavor of mini.css in your webpage by simply adding the following reference inside your HTML page's <head>
tag:
<link rel="stylesheet" href="https://cdn.rawgit.com/Chalarangelo/mini.css/v2.0.0/dist/mini-default.min.css">
If you want to download the package using your favorite package manager, you can use either Bower or NPM:
bower install mini.css
npm install mini.css
We strongly suggest you add the following line inside your HTML page's <head>
to utilize the viewport meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1">
Headings View on Codepen
<h1>Heading 1<small>Subheading</small></h1> <h2>Heading 2<small>Subheading</small></h2> <h3>Heading 3<small>Subheading</small></h3> <h4>Heading 4<small>Subheading</small></h4> <h5>Heading 5<small>Subheading</small></h5> <h6>Heading 6<small>Subheading</small></h6>
Typography
- Basic reset and fix rules applied, based on Normalize.css v5.0.0
- A native font stack is used
- The colors are set to
background: #f5f5f5;
andcolor: #212121;
- The
font-size
is16px
for the root element - The
line-height
is1.5
- All HTML headings are pre-styled
- Styling provided for
<small>
elements inside headings - Common HTML elements like paragraphs, horizontal rules, lists and code elements are pre-styled
- Images are responsive by default
Common textual elements View on Codepen
<p>This is a paragraph with some <strong>bold text</strong> and some <em>italics text</em>.</p> <a href="#">This is a link.</a> <small>This is some small text.</small> <sub>Subscript</sub> <sup>Superscript</sup> <code>Inline code</code> <kbd>Keyboard Input</kbd> <hr> <pre>This is some preformatted text.</pre> <blockquote cite="Quotation source"> This is some quoted text from another website or person. </blockquote>
Lists & images View on Codepen
<ul> <li>Apple</li> <li>Orange</li> <li>Strawberry</li> </ul> <ol> <li>Wake up</li> <li>Eat breakfast</li> <li>Go to work</li> </ol> <img src="...">
Basic layout View on Codepen
<div class="container"> <div class="row"> <div class="col-sm-1"> </div> <div class="col-sm-11"> </div> </div> <div class="row"> <div class="col-sm-2"> </div> <div class="col-sm-10"> </div> </div> <div class="row"> <div class="col-sm-3"> </div> <div class="col-sm-9"> </div> </div> <div class="row"> <div class="col-sm-4"> </div> <div class="col-sm-8"> </div> </div> <div class="row"> <div class="col-sm-5"> </div> <div class="col-sm-7"> </div> </div> <div class="row"> <div class="col-sm-6"> </div> <div class="col-sm-6"> </div> </div> <div class="row"> <div class="col-sm-12"> </div> <div class="row"> <div class="col-sm"> </div> <div class="col-sm"> </div> </div> </div>
Notes
- Based on the Flexbox Layout Module
- Grid structured as follows:
.container
serves as the grid system's wrapper- Multiple
.row
elements serve as the grid system's rows - Multiple
.col-SCR_SZ
and/or.col-SCR_SZ-COL_WD
elements specify serve as the grid system's columns (fluid and preset respectively)
SCR_SZ
values:sm
for screens below768px
widemd
for screens between768px
(inclusive) and1280px
(exclusive)lg
for screens wider than1280px
COL_WD
can be any integer value between1
and12
(both inclusive)- Fluid columns can create irregularly-sized columns in a layout
- You can nest rows inside columns, but not columns inside columns or rows inside rows
- An element can be a row and column at the same time
- You can mix preset and fluid columns
- Always wrap content in columns, never leave content unwrapped inside a row
- Do not mix rows or columns with unwrapped content on the same level
Screen-specific layouts View on Codepen
<div class="container"> <div class="row"> <div class="col-sm"> </div> </div> <div class="row"> <div class="col-sm-12 col-md-3 col-lg-2"> </div> <div class="col-sm-12 col-md-5 col-lg-7"> </div> <div class="col-sm-12 col-md-4 col-lg-3"> </div> </div> <div class="row"> <div class="col-sm"> </div> </div> </div>
Notes
- Apply multiple column classes to the same element, one for each screen size, to define different layouts
- Mobile-first approach, styles specified for smaller screen sizes apply to larger screen sizes if no override is specified
- Try to make page content vertical for smaller devices, using
.col-sm-12
and transition to two or three columns on larger screen sizes - Combine with offsets and reordering as shown below
- You can omit the style of a screen size if it is the same one as the one applied in the immediately smaller screen size
- Always start with a
.col-sm
or.col-sm-COL_WD
style, otherwise smaller devices will not display your content properly
Column offsets View on Codepen
<div class="container"> <div class="row"> <div class="col-sm-10 col-sm-offset-1"> </div> </div> <div class="row"> <div class="col-sm col-sm-offset-2"> </div> </div> <div class="row"> <div class="col-sm-6 col-sm-offset-3"> </div> </div> <div class="row"> <div class="col-sm-8 col-sm-offset-4"> </div> <div class="row"> <div class="col-sm-5 col-sm-offset-1"> </div> <div class="col-sm-5 col-sm-offset-1"> </div> </div> </div>
Notes
- Create offsets using the
.col-SCR_SZ-offset-COL_WD
classes COL_WD
can be any integer from0
to11
(both inclusive)- You can mix offset columns and non-offset columns
- Specify offsets in combination with existing column styling, not instead
- Mobile-first approach, styles specified for smaller screen sizes apply to larger screen sizes if no override is specified
- You can omit offsets whenever not needed, but you will have to override existing offsets for larger screen sizes, using
.col-SCR_SZ-offset-0
Column reordering View on Codepen
<div class="container"> <div class="row"> <div class="col-sm col-md-last col-lg-normal"> </div> <div class="col-sm-first col-md-normal"> </div> <div class="col-sm col-md-first col-lg-normal"> </div> </div> </div>
Notes
- Create reorders using
.col-SCR_SZ-first
,.col-SCR_SZ-last
and.col-SCR_SZ-normal
classes for first, last and normal ordering respectively - Default ordering is based on order of appearance
- Specify reorders in combination with existing column styling, not instead
- Mobile-first approach, styles specified for smaller screen sizes apply to larger screen sizes if no override is specified
- You can use multiple
.col-SCR_SZ-first
and.col-SCR_SZ-last
elements to group your elements according to the desired layout - You can omit reorders whenever not needed, but you will have to override existing reorders for larger screen sizes, using
.col-SCR_SZ-normal
Header View on Codepen
<header> <a href="#" class="logo">Logo</a> <button>Home</button> <a href="#" class="button">News</a> <span>|</span> <button>About</button> <button>Contact</button> </header>
Notes
- Use the
.logo
class for the first child (either textual element or image) - The rest of the elements inside the
<header>
must be<button>
,<label class="button">
or<a class="button">
elements - Use
<span>
elements as separators - You can mix buttons, links and labels inside the header, as long as all of them are styled as buttons
- The logo element should not be a
<button>
element or of the.button
class - Header is not displayed as fixed by default
Navigation bar View on Codepen
<nav> <a href="#">Home</a> <span>News</span> <a href="#" class="sublink-1">New Courses</a> <a href="#" class="sublink-1">Certifications</a> <span class="sublink-1">Events</span> <a href="#" class="sublink-2">Course Showcase - 12th, Dec</a> <a href="#" class="sublink-2">Staff AMA - 16th, Dec</a> <a href="#" class="sublink-1">Policy Update</a> <a href="#">About</a> <a href="#">Contact</a> </nav>
Notes
- Use
<nav>
element, populate it with links - Use
.sublink-1
and.sublink-2
classes to create subcategories in your navigation menu - Combine the navigation bar with grid reordering to display aside from text on larger displays or at the bottom on smaller displays
Footer View on Codepen
<footer> <p>© 2001-2016 Web Corporation | <a href="#">About</a> | <a href="#">Terms of use</a></p> </footer>
Notes
- Simple syntax and structure, add content as normal