MAGICSSIAN

What is it

Magicssian is a CSS Boilerplate to head start a small web project by providing cross-browser consistent styles to default HTML elements with pure css trickery and a bit of design.

Magicssian is a forever-i-am-learning work in progress and relies on the following:

  • The soon-i-hope-their-be-more-awesome CSS Custom Properties.

    I know it is fun to get Sassy but CSS Custom Properties are choosen here in favor of a more native aproach.

  • The postcss-import, postcss-css-variables and postcss-color-function plugins from the PostCSS family

    There are a lot of plugins to choose from, depending on your needs.

  • The Fast and efficient CSS optimizer Clean-CSS.

    All put together with:

  • The easiest build tool Brunch.io.

    Initially Magicssian was build using npm scripts, and there are plans to add a build option using Gulp just for the fun of it.

Get into it


Download
Add the following tag to your html5 document

<link rel="stylesheet" href="./path/to/magicssian.min.css">
and Tadaa! you can start doing some tricks.

The base

You can see how all HTML5 elements look like with Magicssian on this HTML5 test page.
HTML5 test page created by @cbracco

Custom properties

All things avaliable for a custom setup is here, we use the relatively new CSS Custom properties

Reset

a.k.a css variables

The examples

Text

The examples

Headings

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
Paragraph

This is a simple paragraph block with some regular text-level markup, like Strong or Bold, Emphasis or Italics, also an example of using subscript2 and superscript2, del, ins or dfn, abbr for definition and abbreviation respectively. Now a <br />.

A new paragraph block with inline quotations a <code> tag: <a href="" title="title"> and his .variant class <a href="" title="title">.

Here is how a default link looks like followed by a color variant and the base color variant. Finally, a blockquote:

Abracadabra A magician
Preformated text & Code

    class Foo {
      public $publicVariable = 'A public variable';

      function functionName() {
        echo $publicVariable;
      }
    }
Variant
    class Foo {
      public $publicVariable = 'A public variable';

      function functionName() {
        echo $publicVariable;
      }
    }

Lists

Lists are almost untouched, beside font-size and line-height, everything else remains the same.

  • Unordered
    • Nested
  • list
  • item
  1. Ordered
    1. Nested
  2. list
  3. item 3

However, you can customize lists using combinations of the following classes:

.custom [.variant .outlined, .square, .diamond, .dash, .arrow, .no-decoration, .no-indent]
  • .custom (Default)
    • .outlined
  • list
  • item
  • .custom .square
    • .outlined
  • list
  • item
  • .custom .diamond
    • .outlined
  • list
  • item
  • .custom .dash
  • list
  • item
  • .custom .arrow
  • list
  • item
  • .custom .no-decoration
  • list
  • item
  • .custom .no-decoration .no-indent
  • list
  • item

Tables

The examples

Table caption
table headingtable headingtable heading
table foot
table data 0table data 0table data 0
table data 1table data 1table data 1
table data 2table data 2table data 2
Striped
table headingtable headingtable heading
table data 0table data 0table data 0
table data 1table data 1table data 1
table data 2table data 2table data 2
table data 3table data 3table data 3
table data 4table data 4table data 4

Buttons

The examples

Link Button
Link Button Outlined
Link Button Alternative Link Button Outlined Alternative
Link Button Alternative Link Button Outlined Alternative

Form items

This is the legend of a form

The tricks

We like to call'em tricks...

(Flexbox) grid

The examples

Auto width columns

Out of the (Flex)box we can create any number of columns and they will adjust automatically to his container.

column 1
column 2
column 3

Column 1
Column 1
column 3
column 4
column 5
column 6
column 7
Fixed size columns

We use 5 predefined fraction sizes, this give control over elements and flexibility

1/4 column
1/2 column
2/3 column
3/4 column
Nested columns

Easily extend your layout options nesting fixed size columns. Also, we use some flexbox default properties as handy classes to quicly align content or add padding space in any column.

1/2 column nested in 1/2 column = 1/4 column
1/2 column nested in 1/2 column = 1/4 column

Notification

This is information

This is a warning

This is success

This is an error

Hide notification

This is an error

Dropdown navigation

Simple dropdown menus using nested lists, mixed with custom list styles.

.dropdown [.inline]

<ul class="custom no-decoration no-indent dropdown">
  <li>item 1</li>
  <li>item 2 >
    <ul class="custom no-decoration no-indent">
      <li>item 2.1</li>
      <li>item 2.2 >
        <ul class="custom no-decoration no-indent">
          <li>item 2.2.1</li>
          <li>item 2.2.2</li>
          <li>and so on...</li>
        </ul>
      >/li>
    </ul>
  </li>
  <li>item 3</li>
</ul>

The examples

Horizontal scroll container

Display elements horizontally in a constrained size container, scroll only works with mouse or touch gestures.

.container .scroll-h []

<div class="container scroll-h">
  <div class="content">
    <a href="javascript:;" title="Item start" class="">Item start</a>
    <a href="javascript:;" title="Item" class="">Item</a>
  </div>
</div>

The examples

Collapsible container

An accordion-like container, toggle content display using checkbox hack.

.container .collapse []

<div class="container collapse">
  <input type="checkbox" id="check-collapse" name="check-collapse" class="hidden">
  <label for="check-collapse" id="" title="" class="">
    <h5 class="heading">Heading</h5>
  </label>
  <div class="content">
    <li><a href="javascript:;" title="Item 1" class="item">Item 1</a></li>
    <li><a href="javascript:;" title="Item 2" class="item">Item 2</a></li>
  </div>
</div>

The examples

Collection

A collection is like a list, in a box.

.collection []

  <dl class="collection">
    <dt class="heading">
      <h5>Collection 1</h5>
    </dt>
    <dd class="content">
      <ul class="custom no-decoration no-indent">
        <li><a href="javascript:;">Item 1.1</a></li>
        <li><a href="javascript:;">Item 1.2</a></li>                    
      </ul>
    </dd>
  </dl>

The examples

Collection 1
Collection 2.1
Collection 2.2
Collection 3

Tabs

The examples

Tab 1

Etiam pellentesque arcu sed aliquam aliquam. Aenean placerat ipsum nec semper viverra. Nam risus ante, sodales vel commodo id, eleifend vitae nibh.

Tab 2

Cras quis velit non ex ornare congue eget eget odio. Maecenas euismod risus non dignissim faucibus.

Tab 3

Suspendisse potenti. Phasellus porta, ipsum a feugiat suscipit, mauris libero sollicitudin metus, ac dignissim leo neque vitae nibh.