0.3.0 • Published 9 years ago

oocss-utils v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

CSS Utility Classes Build Status

A collection of CSS utility classes - based on Emmet shorthand conventions - to aid in object-oriented CSS development.

Usage

Terse OOCSS classes can be a powerful tool for rapid and scalable development. They can be used independently, or to augment existing objects.

<div class="card">
	<div class="card__photo ta-c">
		<h3>Business Name</h3>
		<div class="fz-s">Some City, America</div>
	</div>
	<div class="card__cell">
		<h3 class="mt-xs mb-xxs">John Doe</h3>
		<div class="fz-s"><span class="fw-b">Member number:</span> 081425</div>
		<div class="mt mb-l">
			123 Main St.<br />
			Columbus, OH 43215
		</div>
		<a href="#" class="button">Select Account</a>
	</div>
</div>

Install

You can download the repo, or install via Bower:

$ bower install css-utils --save-dev

The Classes

Display

SelectorResponsibility
.d-bdisplay block
.d-idisplay inline
.d-ibdisplay inline-block
.d-tbdisplay table
.d-tbcdisplay table-cell
.d-tbrdisplay table-row
.vhvisually hidden, but available for screen readers

Floats

SelectorResponsibility
.fl-lfloat left
.fl-rfloat right
.fl-nfloat none
.cl-bclear both
.cl-lclear left
.cl-rclear right
.cfclear fix (contain floats)

Media

SelectorResponsibility
.rwd-imgresponsive image (max-width: 100%)
.rwd-img-ststretched responsive image (width: 100%)
.intrinsicintrinsic ratio wrapper; default 16:9 ratio
.irimage replacement (@mixin included)

Position

SelectorResponsibility
.pos-rposition relative
.pos-sposition static
.pos-aposition absolute
.pos-fposition fixed

Spacing

SelectorResponsibility
.{p/m}{t/r/b/l}-{xxs/xs/s/l/xl/xxl}apply padding/margin in a given direction (top/right/bottom/left) in a given increment.
.{p/m}-0remove all padding/margin
.m{r/l}-amargin left/right auto (centering)
IncrementValue*
xxs0.146em
xs0.236em
s0.618em
(none)1em
l1.618em
xl4.236em
xxl6.854em

*values derived from golden ratio

Examples:

<div class="mt-xl">
	<!-- 4.236em top margin -->
</div>

<div class="pl-s">
	<!-- 0.618em left padding -->
</div>

<div class="mb">
	<!-- 1em bottom margin -->
</div>

The spacing scale and step progression are configurable. Set these values in your own Sass, before including the css-utils lib:

// default values
$util-ratio: 1.618;
$util-base: 1em;
$util-spacing: (
	xxs: -4,
	xs: -3,
	s: -1,
	base: 0,
	l: 1,
	xl: 3,
	xxl: 4
);

Text

SelectorResponsibility
.ta-ltext align left
.ta-ctext align center
.ta-rtext align right
.ta-jtext align justify
.c-iinherit ancestor text color
.kernenable font kerning
.whs-nwprevent wrapping on whitespace
.truncatelimit text to a single line, truncating with an ellipsis
.fw-lfont weight light (200)
.fw-nfont weight normal (400)
.fw-bfont weight bold (700)
.fs-iitalic
.tt-uuppercase
.wfsmfont anti-aliasing

Vertical Alignment

SelectorResponsibility
.va-talign to top
.va-malign to middle
.va-balign to bottom

License

The MIT License (MIT)