Primal rage of css primitives


Protozaur is semantic, mnemonic, declarative CSS framework, created to avoid wasting time and increase productivity

Why?

  1. Rapid prototyping
  2. Dramatically Reduce the amount and size of CSS/BEM style modificators in CSS files
  3. Declarative approach to add context-dependent style properties to existed CSS classes or BEM blocks

Protozaur's cheat sheet

CSS class CSS style
ma margin: auto
Margin  
m0 ... m100 — (step 5) margin: Xpx !important;
ml0 ... ml100 margin-left: Xpx !important;
mr0 ... mr100 margin-right: Xpx !important;
mt0 ... mt100 margin-top: Xpx !important;
mb0 ... mb100 margin-bottom: Xpx !important;
Padding  
p0 ... p100 padding: Xpx !important;
pl0 ... pl100 padding-left: Xpx !important;
pr0 ... pr100 padding-right: Xpx !important;
pr0 ... pt100 padding-top: Xpx !important;
pb0 ... pb100 padding-bottom: Xpx !important;
Width  
w10 ... w1200 width: Xpx !important;
w5p ... w100p width: X% !important;
Display  
inline display: inline !important
block display: block !important
iblock display: inline-block !important
Table  
ptz--table display: table
ptz--row, ptz--tr display: table-row
ptz--cell, ptz--th, ptz--td display: table-cell; vertical-align: top
Position  
posrel position: relative !important
posabs position: absolute !important
Font style  
fs0, fs10 ... fs30 — (step 1) font-size: Xpx !important;
lh100 ... lh200 line-height: X% !important;
   
tac text-align: center !important
tar text-align: right !important
tal text-align: left !important
taj text-align: justify !important
   
vat vertical-align: top !important
vam vertical-align: middle !important
vab vertical-align: bottom !important
   
b font-weight: bold !important
i font-style: italic !important
n font-style: normal !important
u text-decoration: underline !important
fwn font-weight: normal !important
   
upcase text-transform: uppercase
downcase text-transform: lowercase
   
ffa font-family: Arial
fft font-family: Tahoma
ffv font-family: Verdana
ffg font-family: Georgia
ffm font-family: Monospace
fftnr font-family: Times New Roman
   
br-off white-space: nowrap
br-on white-space: normal
   
ls0 letter-spacing: 0
lsn letter-spacing: normal
Buttons  
ptz--btn button style
ptz--size-10 ... ptz--size-25 button's size. 10px ... 25px
Inputs  
ptz--input, ptz--textarea Input style
ptz--size-10 ... ptz--size-25 inputs's size. 10px ... 25px

How Protozaur works?

Example 1

<h1 class='fs18 lh130 mt20 mb20'>
  Hello World!
</h1>

Will add to your H1 following css properties:

font-size: 18px;
line-height: 130%;
margin-top: 20px;
margin-bottom: 20px;

Example 2

<a href='http://github.com' class='ptz--btn ptz--size-16'>Button to Github</a>

Will show button based on font-size: 16px;

Example 3


<form action='/action.php'>
  <div class='m20'>

    <div class='mb20'>
      <input name='login' type='text' class='ptz--input ptz--size-16 w300'>
    </div>

    <div class='mb20'>
      <input name='email' type='text' class='ptz--input ptz--size-16 w300'>
    </div>

    <div class='clearfix'>
      <div class='pull-right'>
        <input type='submit' class='ptz--submit ptz--size-16'>
      </div>
    </div>

  </div>
</form>

Protozaur's concept

All CSS properties can be split in 2 groups:

  1. decorative properties (background, color, border etc.)
  2. context-dependent properties (margin, padding, font-size etc.)

Protozaur say:

  • It is pointless to write the most part of context-dependent properties in CSS files. It's reason to create tons of additional css declarations for context-dependent modificators

Protozaur advice:

  • We can create some set of global simple CSS modificators. We can use it for context-dependent customization of existed CSS styles or BEM blocks

Protozaur components

  1. reset.css — just the reset file
  2. framework.css — the heart of framework
  3. base.css — some most common css definitions

also will be better to include inputs-buttons componetns:

  1. inputs-buttons/base.css — for using styles for inputs and buttons
  2. inputs-buttons/sizes.css — for set sizes to buttons and inputs

Features

Protozaur:

  1. based on box-sizing: border-box property
  2. based on px and %
  3. based on BEM principals

The MIT License (MIT)

Copyright (c) 2015 Ilya N. Zykin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.