View on GitHub

itcss

Starter CSS boilerplate utilizing the ITCSS pattern

Inverted Triangle CSS Visualization

ITCSS

Travis CI Github Build Codacy Badge Codebeat Badge CodeFactor Badge DeepScan grade Analytics

A starter boilerplate based on the ITCSS (Inverted Triangle CSS) methodology.

Visitor stats

GitHub stars GitHub forks GitHub watchers GitHub followers

Code stats

GitHub code size in bytes GitHub repo size GitHub language count GitHub top language GitHub last commit

About

ITCSS is a mobile-first, responsive, battle-tested CSS framework based on the ITCSS methodology utilizing the BEM methodology.

This boilerplate is intented to be used as a starting point in your application. You should use this as a foundation for your CSS and build on top of it.

If you want to use the full capabilities of this boilerplate such as variables, mixins, etc., then you should include it in your PostCSS files.

You should also install the required PostCSS plugins and configure your PostCSS environment following the configuration file here

You can also use the build which is plain CSS but lacks mixins, custom media queries and other useful tools.

Install

# Via NPM
npm i itcss

# Via Yarn
yarn add itcss

Usage

If you are using a module bundler (such as Webpack, Parcel, Browserify):

# In your CSS entrypoint
@import 'itcss';

# Or if the above does not resolve, try
@import 'itcss/index.css';

There are several predefined variables which you can overwrite:

:root {
	/* Color Variables */
	--color-base: #333;
	--color-primary: #fff;
	--color-secondary: #000;
	--color-action: #ef4c23;

	/* Text Variables */
	--font-sans-serif: sans-serif;
	--font-serif: serif;
	--font-monospace: monospace;
	--font-size-base: 1rem;
	--line-height-base: 1.35;
	--font-size-h1: 2rem;
	--font-size-h2: 1.75rem;
	--font-size-h3: 1.5rem;
	--font-size-h4: 1.25rem;
	--font-size-h5: var(--font-size-base);
	--font-size-h6: 0.75rem;

	/* Transition Variables */
	--timing: 0.4s;
	--easing: ease-in-out;

	/* Spacing between grid items */
	$gap: 0.5rem;

	/* Number of columns in the grid */
	$columns: 12;

	/* The maximum width of the shell container */
	--shell-width: 75rem;

	/* The left and right padding of the shell container */
	$shell-gap: 1rem;

	/* A list of responsive breakpoint names */
	--breakpoints: (xs, sm, md, lg, xl);

	/* A list of display properties */
	--displays: (block, inline, inline-block, flex, inline-flex);

	/* A list of text alignment properties */
	--alignments: (center: center, right: right, left: left, justify: justify);
}

You should place the overwriting variables after the @import statement.

Supported browsers

This boilerplate is using the most recent version of the CSS specification. In order to support more browsers you must use a tool such as PostCSS. The combined and built version of this boilerplate is using the Postcss-Preset-Env in stage: 0. This means that you can use the most recent CSS features and be sure that they will work older browsers.

The combined and built version of this boilerplate has been tested and works in all evergreen browsers (Chrome, Firefox, Edge, Opera, Safari, Brave, Vivaldi, iOS Safari, Chrome on Android, Samsung Internet) and IE 10+.

In order to do so in your setup, please refer to the postcss.config.js file.

Available files, selectors, variables and their usage

Settings

Tools

Generic

Elements

Objects

Components

Utilities

LICENSE

MIT


Connect with me:


                     

Support and sponsor my work: