A customisable CSS framework that strives to be small, yet complete. With a strong focus on typography, clean spacing, and semantic naming conventions, Spirit is the perfect CSS microframework for everyone.
Variables
A convenient set of Sass variables for you to create your own version of Spirit.
Opiniated styles are applied on the HTML heading elements in order to fluidly style them. Use the variables available to customise them to your need.
Typefaces used
These are freely available, high quality typefaces. Butler, Public Sans
Headings
<h1>Heading 1</h1>
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Custom sizes
Custom sizes are not fluid, but they let you 'lock' the font-size of text across all device widths.
<p class="size-1">.size-1</p>
.size-1
.size-2
.size-3
.size-4
.size-5
.size-6
.size-7
Blockquotes
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 50 years, WWF has been protecting the future of nature. The world's leading conservation
organization, WWF works in 100 countries and is supported by 1.2 million members in the United States
and close to 5 million globally.
</blockquote>
Links
Links are specially styled to look better in a block of text.
<a href="www.example.com">Cool link :D</a>
Scale text
A utility class to make the font-size of text content slightly smaller than it's parent. It uses fluid sizing in order to be perfectly responsive.
This sentence, for example, is scaled down.
<p class="scale-text">This sentence, for example, is scaled down.</p>
Title
This provides a sans-serif title font, with extra weight.
<p class="title">Sans-serif title.</p>
Grids:
Use Grids to create responsive layouts that flow in two dimensions. The default grid is 12x12 cells, this can easily be extended to any arbitrary number by using CSS variables. This one stays the same across all viewports:
Composable flexbox utilities allows you to quickly style content that flows in one-dimension. Applying class="container row is-fullheight flex-center" to a div element creates the following content:
Infinitely nestable rows and columns allow you to effortlessly create incredibly complex layouts. Use the full power of Flexbox and Grid to bend CSS to your will.
Note: Fixed width content within a flex container may overflow on smaller displays.
Forms:
Simple styles with rational defaults, to provide a cohesive design.
<form action="#">
<div class="field">
<label for="name">Your name: </label>
<input type="text" placeholder="John Smith" />
<div class="help">Don't worry, your information is safe with us.</div>
</div>
<div class="field">
<label for="email">Email ID: </label>
<input type="email" placeholder="john@email.com" />
</div>
<div class="field">
<label for="name">Country: </label>
<select>
<option>Select dropdown</option>
<option>With options</option>
</select>
</div>
<div class="field">
<label for="textarea">Textarea:</label>
<textarea class="textarea" placeholder="e.g. Hello world"></textarea>
</div>
<button type="button">Button</button>
<p>You can use the color utilities to mix and match your own styles of elements. For example:</p>
<button type="button" class="bg-green white border border--black lighten">Custom button</button>
</form>
Tables:
Tables are minimally styled, and come with a handy .table-container class for horizontally scrollable tables.
Name
ID
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Favorite Color
Jim
00001
Green
Green
Green
Red
Blue
Blue
Blue
Blue
Blue
Blue
Sue
00002
Red
Green
Green
Green
Green
Blue
Blue
Red
Red
Red
Barb
00003
Red
Red
Red
Red
Red
Blue
Blue
Green
Green
Green
<!--
Standard HTML markup will suffice,
for most use cases. The wrapper class
is provided for cases where overflow is expected.
-->
<div class="table-container">
<!-- Table markup -->
</div>
Images
Images are styled using an aspect ratio box technique. It requires you to add the aspect ratio of the image using the style attribute.
These images will maintain their aspect ratio across all viewports. In combination with using the picture tag, responsive images has never been easier.
Note: Based on code from this article. In particular, Thierry Koblentz's work.
Elements
A collection of other useful elements and styles.
Box
The box element is a simple container with padding and shadow. It can contain any arbitrary content.
<div class="box">
<p>Box element.</p>
</div>
Lists
Unordered lists:
List item 1
List item 2
List item 3
List item 4
Ordered lists:
List item 1
List item 2
List item 3
List item 4
Horizontal rule:
A restyled horizontal rule element you can use to add class to your design.
Article wrapper & breakout
It's common to see articles limit the width of the content on wide displays in order to improve readability. Spirit provides a Grid powered wrapper for this situation, which is completely responsive. As a bonus, it also supplies a customisable .breakout class which you can use to allow elements to be fullwidth, responsively.
Example
This content will only extend until a max-width of 480px, beyond which it will start wrapping. This width is customisable inline. The default can be customised in the _variables.scss file.
On the other hand, this content is placed within a .breakout class. This means that it will always span the fullwidth of the viewport. This is especially useful for images or charts.
This effect is easily nestable, as seen on this very element. All the content on this page has been wrapped in this style, with this element being wrapped twice.
Use these utility classes to perfectly position your content using margins and padding.
Available class prefixes:
.mt
.mr
.mb
.ml
.pt
.pr
.pb
.pl
In order to use these classes, combine a prefix with one of the following levels to achieve the desired result. For example, .mr-3 defines margin-right: 1.75 rem.
Level
Value
0
0
1
0.75 rem
2
1.25 rem
3
1.75 rem
4
2.25 rem
5
2.75 rem
Special class: .mx-auto sets margin: auto on the left and right. Useful for centering content, but honestly, you should just use flexbox.
Responsive helpers
A host of helper classes to conditionally display content based on the viewport width. There are 9 helper classes. Resize your window to see the effect.
This sentence is hidden on mobile devices.
This sentence is hidden on tablets.
This sentence is hidden on desktops.
This sentence is hidden on widescreen.
This sentence is hidden upto touch devices.
This sentence is hidden from tablet and above.
This sentence is hidden from desktop and above.
This sentence is hidden from widescreen and above.
This sentence is hidden from fullhd and above.
Note: These helpers were taken directly from Bulma CSS.
Color helpers
Spirit includes a tiny set of classes to quickly style the background, font-color or border-color of any element.