Bask - CSS Library

Documentation and demo

Bask is a responsive CSS library built in SASS (SCSS), with a focus on consistency and utility classes.

Getting started

There are 3 ways to get Bask:

assets/css/core/_utils.scss

Utils

Bask has many utility CSS classes aimed to speed up the development process, without polarizing it.


Padding util

.pad is the utility to handle the padding. It has 2 parameters, which go directly in the class name.

.pad-{direction}-{number}, where {direction} has to be a value from the $directions map (t = top,r = right,b = bottom,l = left), and {number} is our multiplier for the $u variable

<div class="pad-r-3">
padding-right: 24px;

pad is padding
r is right, the direction
3 is the multiplier parameter.
Which translates to padding-right: 24px;, because the multiplier parameter (3) gets multiplied by 8px.

Margin util

.mar is the utility to handle the margin. It has 2 parameters, which go directly in the class name.

.mar-{direction}-{number}, where {direction} has to be a value from the $directions map (t = top,r = right,b = bottom,l = left), and {number} is our multiplier for the $u variable

<div class="mar-b-4">
margin-bottom: 32px;

mar is margin
b is bottom, the direction
4 is the multiplier parameter.
Which translates to margin-bottom: 32px;, because the multiplier parameter (4) gets multiplied by 8px.

Color util

.color is the utility to handle the color. It has 1 parameter.

.color-{variable} where {variable} is the color variable defined in the _variables.scss file.
By default there are 5 color variables in Bask: main, alt, off, white and black.

<div class="color-main">
color: $main;

Background color util

.bg is the utility to handle the background-color. It has 1 parameter.

.bg-{variable} where {variable} is the color variable defined in the _variables.scss file.
By default there are 5 color variables in Bask: main, alt, off, white and black.

<div class="bg-black">
background-color: $black;

Spacer (padding) util

.spacer is the utility to generate a vertical spacer via padding.

.spacer-{value} where {value} is a number which goes from 0 to 5.
This value will get multiplied by 8px (the $u variable) a number of times. Check the mixin in the assets/css/core/_mixins.scss file for more info.

<div class="spacer-1">
padding-top: 64px;
padding-bottom: 64px;

Spacer (margin) util

.spacer-margin is the utility to generate a vertical spacer via margin.

.spacer-margin-{value} where {value} is a number which goes from 0 to 5.
This value will get multiplied by 8px (the $u variable) a number of times. Check the mixin in the assets/css/core/_mixins.scss file for more info.

<div class="spacer-margin-2">
margin-top: 128px;
margin-bottom: 128px;

Display utils

.d is the utility to handle the display property. It can have multiple parameters.

.d-{value} where {value} is the display property.

<div class="d-b">
display: block;
<div class="d-i">
display: inline;
<div class="d-ib">
display: inline-block;
<div class="d-f">
display: flex;

The display flex utility class has a few modifiers to handle the flexbox.
.d-f-y stands for the Y axis of the flexbox (container), it needs 1 more modifier:

<div class="d-f-y-center">
align-items: center;
<div class="d-f-y-start">
align-items: flex-start;
<div class="d-f-y-end">
align-items: flex-end;

.d-f-x handles the X axis, requiring 1 additional modifier:

<div class="d-f-x-center">
justify-content: center;
<div class="d-f-x-start">
justify-content: flex-start;
<div class="d-f-x-end">
justify-content: flex-start;
<div class="d-f-x-between">
justify-content: space-between;
<div class="d-f-x-around">
justify-content: space-around;
<div class="d-f-x-evenly">
justify-content: space-evenly;

Width util

.w is the utility to handle the width size based on %. It has 1 parameter.

.w-{value} where {value} is the % value of the size, and it ranges from 0 to 100

<div class="w-40">
width: 40%;

Height util

.h is the utility to handle the height size based on %. It has 1 parameter.

.h-{value} where {value} is the % value of the size, and it ranges from 0 to 100

<div class="h-70">
height: 70%;

assets/css/core/_utils.scss

assets/css/core/_mixins.scss

Grid System


Bask's grid system is based on CSS Grid, and it works with just 2 elements (container and column) instead of the typical trio (container, row and column).
Check the mixin in the assets/css/core/_mixins.scss file for more info.

<div class="grid">
display: grid;
<div class="col-7">
grid-column: span 7 / span 7;

assets/css/core/_variables.scss

Variables


Bask uses SASS (SCSS) variables to handle media query breakpoints, colors, fonts, but most importantly the $u variable.

The whole idea around the $u variable is to keep a good amount of CSS/UI consistency, which is quite useful when it comes to develop and maintain the visual aspect of web projects, aswell for theming and scaling up/down the UI (responsive, accesibility).

assets/css/elements/_typography.scss

assets/css/core/_mixins.scss

Typography

Bask's typography file contains both some default style for typography, such as headings, some classes to manipulate text and a few utility classes (text oriented).

The font sizes (and more) are handled via the text() mixin which implements a fluid type scale based on https://www.fluid-type-scale.com/


Title

.title is the class which states the default title styles, it supports 6 size modifiers:

<div class="title title-1">
Title 1
<div class="title title-2">
Title 2
<div class="title title-3">
Title 3
<div class="title title-4">
Title 4
<div class="title title-5">
Title 5
<div class="title title-6">
Title 6

Text

.text is the class which states the default text styles, it supports 6 size modifiers.

<div class="text text-xl">
Text XL
<div class="text text-l">
Text L
<div class="text text-m">
Text M
<div class="text text-s">
Text S
<div class="text text-xs">
Text XS

Text utils

<div class="text text-m text-center">
Text M - Center
<div class="text text-m text-left">
Text M - Left
<div class="text text-m text-right">
Text M - right
<div class="text text-m text-uppercase">
Text M - uppercase
<div class="text text-m text-lowercase">
Text M - lowercase
<div class="text text-m font-w-900">
Text M - Font weight 900
<div class="text text-m font-w-800">
Text M - Font weight 800
<div class="text text-m font-w-700">
Text M - Font weight 700
<div class="text text-m font-w-600">
Text M - Font weight 600
<div class="text text-m font-w-500">
Text M - Font weight 500
<div class="text text-m font-w-400">
Text M - Font weight 400
<div class="text text-m font-w-300">
Text M - Font weight 300
<ul class="list"> <li>content</li>
  • Styled list (UL > LI)