Mimic

By Peter Chon

Mimic isn't a framework, it's inline-css, class-fied.

Most CSS frameworks are absolutely beautiful and simple to use. However, it takes a lot of work to make it your own. It's hard enough to be creative, but to override and re-work other craftsman's design is quite the challenge. This is probably why we see so many "like-minded" websites.

I work with a lot legacy codes. Most are written with the best of intentions (initially.) This means that most of my day is spent hunting down that one rogue class or inherited styles.

I'm guilty of it myself - starting the project with carefully thought-out SASS structure with sensible, modular approach to writing beautifully-orchestrated symphony of classes and inheritance. It's CSS nirvana. After submitting for review and QA, you start to find holes. Ugly, one-of-a-kind holes that needs to be patched with an equally ugly, non-sensical, duplicating work-arounds and hacks that will ultimately end with the humiliating !important declaration(s).

After going through the same insanity over and over again, I started to think "Why not use CSS property name as my class name?" Sure it's little more work, but I'll always be able to control the style by just adding or removing a class name. Plus, I don't have to keep coming up with class names that makes sense.

Example:

This would be a usual paragraph with a defined class that specifies a padding-bottom of 50px.

This would be the same paragraph but with a class of "padding-bottom:0".

One of the advantages of using a system like Mimic is that you can always tell how the element is going to look without having to render it. If you see this code:

<p class="margin-top:20 padding:10 bg-color:black border-radius:5 color:white align:right">Can you guess how I would render?</p> show

Yey!

Would you have any question as to how that paragraph would render?

“That's a lot of classes to write.”

Maybe. But from my experience, most time I write CSS to over-write existing styles. And all of the CSS-classes are written with just one property. If it needs to be extended, then you can always write a custom CSS class.

Again, this is just how I started to write my css. If you don't like it, I recommend you checkout bootstrap.

Still reading? awesome. So, let's get to it.

How to use Mimic.

Since mimic tries override as a class-level style, I would put it after your custom css file.

<link rel="stylesheet" href="mimic.css">
Download Mimic View on Github

Mimic is easy.

Here's what you get with mimic.

In case you need it, I have grids. Mimic gives you a choice of 12/10/7 grid system with an 2% left-margin between the columns. Why so many? Because I like choices.

<div class="row:12">
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
</div>

1
1
1
1
1
1
1
1
1
1
1
1

<div class="row:10">
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
</div>

1
1
1
1
1
1
1
1
1
1

<div class="row:7">
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
  <div class="col:1">1</div>
</div>

1
1
1
1
1
1
1

<div class="row:12">
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
</div>

2
2
2
2
2
2

<div class="row:10">
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
  <div class="col:2">2</div>
</div>

2
2
2
2
2

<div class="row:12">
  <div class="col:3">3</div>
  <div class="col:3">3</div>
  <div class="col:3">3</div>
  <div class="col:3">3</div>
</div>

3
3
3
3

<div class="row:12">
  <div class="col:4">4</div>
  <div class="col:4">4</div>
  <div class="col:4">4</div>
</div>

4
4
4

<div class="row:12">
  <div class="col:6">6</div>
  <div class="col:6">6</div>
</div>

6
6

<div class="row:12">
  <div class="col:7">7</div>
  <div class="col:5">5</div>
</div>

7
5

<div class="row:12">
  <div class="col:8">8</div>
  <div class="col:4">4</div>
</div>

8
4

<div class="row:12">
  <div class="col:9">9</div>
  <div class="col:3">3</div>
</div>

9
3

<div class="row:12">
  <div class="col:10">10</div>
  <div class="col:2">2</div>
</div>

10
2

<div class="row:12">
  <div class="col:11">11</div>
  <div class="col:1">1</div>
</div>

11
1

<div class="row:12">
  <div class="col:12">12</div>
</div>

12

offset12s — Trailing ':#' is the offset12 amount, i.e. 1:10 would be col:1 offset:10

<div class="row:12">
  <div class="col:2 offset:9">…</div>
  <div class="col:1">…</div>
</div>

2:10
1

<div class="row:12">
  <div class="col:10 offset:1">…</div>
  <div class="col:1">…</div>
</div>

10-1
1

<div class="row:12">
  <div class="col:4 offset:1">…</div>
  <div class="col:2 offset:3">…</div>
  <div class="col:2">…</div>
</div>

4-1
2-3
2

Nested

<div class="row:12">
  <div class="col:9 row:12">
    <div class="col:5">…</div>
    <div class="col:7 row:12">
      <div class="col:4 offset:5">…</div>
      <div class="col:3">…</div>
    </div>
  </div>
  <div class="col:3 row:12">
    <div class="col:6">…</div>
    <div class="col:6">…</div>
  </div>
</div>

col:5
col:4 offset:5
col:3
col:6
col:6

Continuing row:12s — When building HTML lists

<div class="row:12">
  <div class="col:8">…</div>
  <div class="col:4">…</div>
  <div class="col:4 restart-row:12">…</div>
  <div class="col:8">…</div>
</div>

8
4
4: add "restart-grid" class
8

More to come, including jQuery-less js components. Please stay tuned!