Mad Skeleton github

A small CSS boilerplate/wireframe for quick start with web project.

TOC

  1. You are here
  2. MADCSS philosophy
    1. Naming things
    2. Architecture
    3. Quirks and rules
  3. Modules
    1. area
    2. button
    3. icon
    4. naked-link
    5. picture
    6. progress-bar
    7. table
    8. text
  4. Typography
  5. Colors

MADCSS philosophy

MADCSS stands for Modular Attribute-Driven CSS. Yeah, sooo clever. Basic architecture is based on inspired by: AMCSS, Gemma, Organic CSS, Atomic Design and Tachyons.

The base global prefix for all attribute modules is i-, as in "interface".

Naming things

Attribute names are defined in a simple fashion: attribute always starts with the global prefix, followed by module name. If it's a child, then it appends a double hyphen, followed by the child name. Both parent and child names are written with catepillar-case And try not going deeper than 2 levels with that: i.e. grandchildren and further are forbidden.

<prefix>-<parent-name>[--<child-name>]

Warning: uppercase letters in attribute names are invalid HTML and can cause bugs in some browsers (as most browsers tend to auto-fix that problem in your code).

Modifiers are a space-separated strings, so basically you can use any character you want (except space of course):

<div i-void--friedrich-nietzsche="2/3 isDead +_- żółć 鸡汤">…</div>

And then you would write something like this in your .(s)css file:

/* nietzsche module */
[i-void--friedrich-nietzsche] { all: unset; }
[i-void--friedrich-nietzsche~="2/3"] { all: unset; }
[i-void--friedrich-nietzsche~="isDead"] { all: unset; }
[i-void--friedrich-nietzsche~="+_-"] { all: unset; }
[i-void--friedrich-nietzsche~="żółć"] { all: unset; }
[i-void--friedrich-nietzsche~="鸡汤"] { all: unset; }

Architecture

There are literally five mandatory files you need -- the rest are custom modules (you can delete existing ones, just don't tell me about it). Building new things happens in modules/ directory and you will define global variables in -- wait for it -- variables.css! GASP!

modules/
  nietzsche.css
  complex-thing/
    complex-thing.css
    complex-thing-part.css
    complex-thing-config.css
setup/
  root.css
  states.css
  typography.css
aggregate.css
variables.css

As for variables, make sure that you define module private ones in the :root {} block on top of the file. If multiple modules use a variable, you should put in in global file.

The setup/ dir contains some resets for the whole project and simple typography normalisations.

Modules can be either structure- and layout-related selectors that do one, generic thing extremely well -- or a context-specific selectors for distinct components of an interface. They can be naturally mixed with each other -- as long as it makes sense of course. And if you need a humongous module, create a separate modules/moduleName/ directory with same name as module and include all partials in modules/moduleName/moduleName.css file.

Quirks and rules

  1. Colors Purity -- the thing I am passionately crazy about: define new colors only inside variables.css to assure your design is not "50 shades of gray". Also try learning some proper words for naming them: like "amaranth" is much better than "redLight2".
  2. The Leading Principle -- we want all of the elements, texts and empty spaces to be a multiplication of leading size (line-height of root element in CSS). That way, we assure things look beautiful and we avoid the issue of "50 shades of margins" (yes, I don't know much jokes).
  3. Inverse Swiss Army knife -- avoid creating too diverse modules with plenty of modifiers, as it will be hell to maintain. In this instance I would prefer to make them a bit DRY instead. You can also try creating a "shared module" or go with some @mixin if you'd use SASS.

Modules

area

<div i-area="charcoal medium-v">…</div>

Area has two functions: setting the colors (background & text) and paddings.

There are three sizes for spacing: medium, half and double. While defining paddings use optional -v and -h suffixes for setting only vertical (top & bottom) or horizontal (left & right) spacing.

There are no single-side modifiers (top, bottom, left and right), as we want to keep the leading flow of the document pristine and we also try to follow The LEGO Way of handling spacing of stuff.

charcoal area, padded half size
silver area, padded medium size
violet area in silver area, that is in purple area that is in amaranth area, whilst all of them padded in some random way

button

<div i-button="double">…</div>

A relatively complex button component with sizes, hover, active, focus and disabled states.

default
amaranth
hover
active
focus
disabled
full
double
triple
quadruple

icon

<div i-icon="double"><use xlink:href="#symbol-eye"/></div>

Small component styling the SVG icons added with <use>. Just add them in _assets/icons and let grunt-svgstore do its work.

default
double
triple
amaranth
purple
violet
white
silver

naked-link

<a href="/" i-naked-link>
  <img src="2dogs1cat.gif"/>
</a>

For when you need to wrap <a> tag around something big, and don't want to have this silly underline styles. It relies on slighty changing opacity for :href and :active states.

ugh I feel ugly :-(
me likes I am complete ॐ

picture

<figure i-picture>
  <a i-picture--link>
    <img i-picture--image src="foo.jpg"/>
  </a>
  <figcaption i-picture--caption>Qwerty</figcaption>
<figure>

A picture module with thumbnail link opening original-sized image in new tab/window. It has optional caption and styles for broken images.

For including thumbnail-with–link-images there is a Node script that goes through src/images, copies original images and creates resized _small and _small@2x thumbnails. But the only thing you really need to know is:

  1. Run npm run images:build
  2. Include modules/picture.liquid liquid template
aleksandra-waliszewska/Untitled_1.jpg
aleksandra-waliszewska/Untitled_2.jpg
dogs-of-titanic/tree-of-david.png
Tree of David @ Dogs of Titanic book cover ideas
bez_tytulu.jpg
nope/nada/void/still_broken_bez_tytulu_qwerty_1.jpg
Bez tytułu

progress-bar

<div i-progress-bar>
  <span i-progress-bar--indicator style="width: 99%;"></span>
</div>

Progress bars consist of a bar and an indicator. Indicator size should be probably managed by JavaScript with setting percentage width. It fills the vertical space on default, but has a short modifier too. There is also a nice pending animation.

default:

short:

table

<table i-table="hoverable">
  <caption>…</caption>
  <thead>
    <tr>
      <th>…</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>…</td>
    </tr>
  </tbody>
</table>
Middle Jurassic sections
Name Period [Mya] Duration [My] Species
Callovian 166-163 3 Agilisaurus, Liopleurodon, Huayangosaurus
Bathonian 168-166 2 Metriorhynchus, Teleidosaurus, Shunosaurus
Bajocian 170-168 2 Belemnites, Ophionautilus, Somalinautilus
Aalenian 174-170 4 Abbasites, Belemnites, Steneosaurus
Total 174-163 11 Agilisaurus, Liopleurodon, Huayangosaurus, Metriorhynchus, Teleidosaurus, Shunosaurus, Belemnites, Ophionautilus, Somalinautilus, Abbasites, Steneosaurus

In the situation you need the table to fit in the container, makie it fullwidth and the text will wrap on single characters instead (ugly, I know). Useful if you don't control the content, or the content is raw urls ♥

Bigges dinos evah Agilisaurusliopleurodonhuayangosaurusmetriorhynchusteleidosaurusshunosaurusbelemnitesophionautilussomalinautilusabbasitessteneosaurus
Bigges dinos evah
Agilisaurusliopleurodonhuayangosaurusmetriorhynchusteleidosaurusshunosaurusbelemnitesophionautilussomalinautilusabbasitessteneosaurus

text

<div i-text="trimmed bold 200%">…</div>

Changes the appearance of the text (weights, case and alignment) and has a special trimmed modifier for ellipsis-trimming of long lines.

lefted

makes given
inline content
align to the left side

centered

makes given
inline content
align to the center

righted

makes given
inline content
align to the right side

trimmed

makes text trimmed if there is not enough space causing said text to being too long to fit in one line of text on the page or in some other unnamed container that has a limited width

uppercased

This is uppercased sentence.

lowercased

This is lowercased sentence.

nowrap

This text will not wrap.

300 or light

Genesis

400 or regular

John

600 or semibold

Tough cookie

700 or bold

Avant-garde

75%

75% size

150%

150% size

200%

200% size

300%

300% size

Typography

Headers

h1

header level 1

h2

header level 2

h3

header level 3

h4

header level 4

Paragraph and inline elements

Paragraph strong lorem ipsum emphasis dolor sit small, consectetur adipisicing elit, tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, sup nostrud exercitation ullamco aliquip ex ea commodo consequat. Duis aute irure sub rep rehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint inline.code.block(); occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lists

  • unordered
  • list
  • element
  1. ordered
  2. list
  3. element

Quotes

A difficult task is a sign from the universe that you should be on the internet right now.

Toothpaste for Dinner

Colors

amaranth
purple
violet
gold
white
silver
charcoal