Concise Utils
Utility classes for Concise CSS
Content
- Introduction
- Installation
- Utilities
- Borders
- Colors
- Columns
- Hide/Show
- Display
- Margins
- Paddings
- Position
- Type Scale
- Typography
- License
Introduction
Concise Utils is one of the official add-ons for Concise CSS. It provides helper classes that you can use in your markup for fast prototyping or context-dependent styles.
Helper classes are prefixed with an underscore (_
) to distinguish them from components or elements.
Installation
With NPM
npm install concise-utils
Using the CDN
<!-- Normal - Latest version --><link rel="stylesheet" href="https://cdn.concisecss.com/concise-utils/concise-utils.css"> <!-- Minified - Latest version --><link rel="stylesheet" href="https://cdn.concisecss.com/concise-utils/concise-utils.min.css">
That is for the latest version, if you want to use a specific one you can do something like the following:
<!-- Normal - Specific version --><link rel="stylesheet" href="https://cdn.concisecss.com/concise-utils/v1.0.0/concise.css"> <!-- Minified - Specific version --><link rel="stylesheet" href="https://cdn.concisecss.com/concise-utils/v1.0.0/concise.min.css">
Utilities
Borders
There are several classes available to delete or add borders to elements. Those classes begin with a b
, the initial letter of the side where the class works (optional) and the size of the border from 0 to
4`.
Classes that work on all the sides are composed only of the letter b
and the width, for example, _b1
.
Reset
<!-- Reset all the borders -->… <!-- Reset top border -->… <!-- Reset right border -->… <!-- Reset bottom border -->… <!-- Reset left border -->…
1px border
<!-- All the borders -->… <!-- Top border -->… <!-- Right border -->… <!-- Bottom border -->… <!-- Left border -->…
2px border
<!-- All the borders -->… <!-- Top border -->… <!-- Right border -->… <!-- Bottom border -->… <!-- Left border -->…
3px border
<!-- All the borders -->… <!-- Top border -->… <!-- Right border -->… <!-- Bottom border -->… <!-- Left border -->…
4px border
<!-- All the borders -->… <!-- Top border -->… <!-- Right border -->… <!-- Bottom border -->… <!-- Left border -->…
Colors
All the colors in the color palette are available as classes to be used directly within your HTML.
The classes for text colors are prefixed with _c-
and _bg-
for backrounds.
The color follows the same schema in the $colors map. For example, you can use the color obtained with getColor(base, primary)
in HTML as _c-base-primary
for text or _bg-base-primary
for backgrounds.
Text Colors
<!-- Equivalent to getColor(base, primary) -->… <!-- Equivalent to getColor(base, selection) -->… <!-- Equivalent to getColor(base, lines) -->… <!-- Equivalent to getColor(text, primary) -->… <!-- Equivalent to getColor(text, secondary) -->… <!-- Equivalent to getColor(text, heading) -->… <!-- Equivalent to getColor(text, ui) -->… <!-- Equivalent to getColor(background, dark) -->… <!-- Equivalent to getColor(background, light) -->… <!-- Equivalent to getColor(background, body) -->… <!-- Equivalent to getColor(state, muted) -->… <!-- Equivalent to getColor(state, primary) -->… <!-- Equivalent to getColor(state, success) -->… <!-- Equivalent to getColor(state, warning) -->… <!-- Equivalent to getColor(state, error) -->… <!-- Equivalent to getColor(blue, darker) -->… <!-- Equivalent to getColor(blue, dark) -->… <!-- Equivalent to getColor(blue, base) -->… <!-- Equivalent to getColor(blue, light) -->… <!-- Equivalent to getColor(blue, lighter) -->… <!-- Equivalent to getColor(green, darker) -->… <!-- Equivalent to getColor(green, dark) -->… <!-- Equivalent to getColor(green, base) -->… <!-- Equivalent to getColor(green, light) -->… <!-- Equivalent to getColor(green, lighter) -->… <!-- Equivalent to getColor(red, darker) -->… <!-- Equivalent to getColor(red, dark) -->… <!-- Equivalent to getColor(red, base) -->… <!-- Equivalent to getColor(red, light) -->… <!-- Equivalent to getColor(red, lighter) -->… <!-- Equivalent to getColor(gray, darker) -->… <!-- Equivalent to getColor(gray, dark) -->… <!-- Equivalent to getColor(gray, base) -->… <!-- Equivalent to getColor(gray, light) -->… <!-- Equivalent to getColor(gray, lighter) -->…
Background Colors
<!-- Equivalent to getColor(base, primary) -->… <!-- Equivalent to getColor(base, selection) -->… <!-- Equivalent to getColor(base, lines) -->… <!-- Equivalent to getColor(text, primary) -->… <!-- Equivalent to getColor(text, secondary) -->… <!-- Equivalent to getColor(text, heading) -->… <!-- Equivalent to getColor(text, ui) -->… <!-- Equivalent to getColor(background, dark) -->… <!-- Equivalent to getColor(background, light) -->… <!-- Equivalent to getColor(background, body) -->… <!-- Equivalent to getColor(state, muted) -->… <!-- Equivalent to getColor(state, primary) -->… <!-- Equivalent to getColor(state, success) -->… <!-- Equivalent to getColor(state, warning) -->… <!-- Equivalent to getColor(state, error) -->… <!-- Equivalent to getColor(blue, darker) -->… <!-- Equivalent to getColor(blue, dark) -->… <!-- Equivalent to getColor(blue, base) -->… <!-- Equivalent to getColor(blue, light) -->… <!-- Equivalent to getColor(blue, lighter) -->… <!-- Equivalent to getColor(green, darker) -->… <!-- Equivalent to getColor(green, dark) -->… <!-- Equivalent to getColor(green, base) -->… <!-- Equivalent to getColor(green, light) -->… <!-- Equivalent to getColor(green, lighter) -->… <!-- Equivalent to getColor(red, darker) -->… <!-- Equivalent to getColor(red, dark) -->… <!-- Equivalent to getColor(red, base) -->… <!-- Equivalent to getColor(red, light) -->… <!-- Equivalent to getColor(red, lighter) -->… <!-- Equivalent to getColor(gray, darker) -->… <!-- Equivalent to getColor(gray, dark) -->… <!-- Equivalent to getColor(gray, base) -->… <!-- Equivalent to getColor(gray, light) -->… <!-- Equivalent to getColor(gray, lighter) -->…
Columns
Is possible to split the content into several columns, up to 12 by default, using the column utilities.
Those classes use the #[a(href='https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns/Using_multi-column_layoutsare different') Multicolumn layout], so they are distinct from the grid included in the core of Concise CSS.
Also, there is a class to build masonry-type layouts with pure CSS quickly.
Columns
<div class="_cols-1">…</div><div class="_cols-2">…</div>…<div class="_cols-11">…</div><div class="_cols-12">…</div>
Gap between columns
You can set the space between the columns, by default it will have the value of the #[code $gutter] variable.
<div class="_col-gap">…</div>
Masonry layout
<div class="_masonry">…</div>
Hide/Show
You can hide or show elements depending on certain key points, like the device size, resolution, or media (printing or screen).
Show elements
<!-- Show only on extra small devices -->… <!-- Show only on small devices -->… <!-- Show only on medium devices -->… <!-- Show only on large devices -->… <!-- Show only on extra large devices -->… <!-- Show only on print -->… <!-- Show only on high density (retina) devices -->…
Hide elements
<!-- Hide only on extra small devices -->… <!-- Hide only on small devices -->… <!-- Hide only on medium devices -->… <!-- Hide only on large devices -->… <!-- Hide only on extra large devices -->… <!-- Hide only on print -->… <!-- Hide only on high density (retina) devices -->…
Display
The display
properties are also exposed via HTML classes so you can use them in your markup quickly.
<!-- Equivalent to display: inline-block -->… <!-- Equivalent to display: block -->… <!-- Equivalent to display: inline -->… <!-- Equivalent to display: flex -->…
Margins
As with the borders, you have predefined classes to reset or add margins. They will use the value in the spacing variables defined in the settings file.
These variables can be especially useful to keep your CSS clean, by adding margins in your markup depending of the context without having to create extra styles, or a component/element variant.
Reset margins
<!-- Reset all margins -->… <!-- Reset top margin -->… <!-- Reset right margin -->… <!-- Reset bottom margin -->… <!-- Reset left margin -->…
Margins on all sides
<!-- Extra small margin on all sides -->… <!-- Small margin on all sides -->… <!-- Medium margin on all sides -->… <!-- Large margin on all sides -->… <!-- Extra large margin on all sides -->…
Extra small margins
<!-- Extra small top margin -->… <!-- Extra small right margin -->… <!-- Extra small bottom margin -->… <!-- Extra small left margin -->…
Small margins
<!-- Small top margin -->… <!-- Small right margin -->… <!-- Small bottom margin -->… <!-- Small left margin -->…
Medium margins
<!-- Medium top margin -->… <!-- Medium right margin -->… <!-- Medium bottom margin -->… <!-- Medium left margin -->…
Large margins
<!-- Large top margin -->… <!-- Large right margin -->… <!-- Large bottom margin -->… <!-- Large left margin -->…
Extra large margins
<!-- Extra large top margin -->… <!-- Extra large right margin -->… <!-- Extra large bottom margin -->… <!-- Extra large left margin -->…
Paddings
The same classes used for margins are also available for paddings with a slightly different syntax, a p
instead of an m
.
Reset paddings
<!-- Reset all paddings -->… <!-- Reset top padding -->… <!-- Reset right padding -->… <!-- Reset bottom padding -->… <!-- Reset left padding -->…
Paddings on all sides
<!-- Extra small padding on all sides -->… <!-- Small padding on all sides -->… <!-- Medium padding on all sides -->… <!-- Large padding on all sides -->… <!-- Extra large padding on all sides -->…
Extra small paddings
<!-- Extra small top padding -->… <!-- Extra small right padding -->… <!-- Extra small bottom padding -->… <!-- Extra small left padding -->…
Small paddings
<!-- Small top padding -->… <!-- Small right padding -->… <!-- Small bottom padding -->… <!-- Small left padding -->…
Medium paddings
<!-- Medium top padding -->… <!-- Medium right padding -->… <!-- Medium bottom padding -->… <!-- Medium left padding -->…
Large paddings
<!-- Large top padding -->… <!-- Large right padding -->… <!-- Large bottom padding -->… <!-- Large left padding -->…
Extra large paddings
<!-- Extra large top padding -->… <!-- Extra large right padding -->… <!-- Extra large bottom padding -->… <!-- Extra large left padding -->…
Position
Concise Utils also exposes all the values of the position
property so you can use them directly in your HTML.
<!-- Equivalent to position: absolute -->… <!-- Equivalent to position: relative -->… <!-- Equivalent to position: static -->… <!-- Equivalent to position: fixed -->…
Type Scale
The first ten sizes in the primary type scale are available to use in HTML; those are built using the typeScale()
function and are updated depending on your settings.
<!-- Equivalent to typeScale(1) -->… <!-- Equivalent to typeScale(2) -->… <!-- Equivalent to typeScale(3) -->… <!-- Equivalent to typeScale(4) -->… <!-- Equivalent to typeScale(5) -->… <!-- Equivalent to typeScale(6) -->… <!-- Equivalent to typeScale(7) -->… <!-- Equivalent to typeScale(8) -->… <!-- Equivalent to typeScale(9) -->… <!-- Equivalent to typeScale(10) -->…
Typography
Lastly, Concise Utils offers a variety of helper classes for typography that you can use when prototyping your website or to add styles depending on the context.
<!-- Equivalent to font-weight: bold -->… <!-- Equivalent to text-transform: uppercase -->… <!-- Equivalent to font-size: inherit -->… <!-- Equivalent to font-style: italic -->… <!-- Equivalent to text-decoration: none -->… <!-- Equivalent to font-weight: normal -->… <!-- Equivalent to font-feature-settings: "smcp" 1, "c2sc" 1 -->… <!-- Equivalent to text-align: center -->… <!-- Equivalent to text-align: left -->… <!-- Equivalent to text-align: right -->… <!-- Equivalent to text-decoration: underline -->… <!-- Equivalent to letter-spacing: $letter-spacing -->…
Font families
<!-- Equivalent to font-family: inherit -->… <!-- Equivalent to font-family: $font-primary -->… <!-- Equivalent to font-family: $font-secondary -->… <!-- Equivalent to font-family: $font-mono -->… <!-- Equivalent to font-family: $font-print-primary -->… <!-- Equivalent to font-family: $font-print-secondary -->…
License
MIT - James Kolce