1.2.20 • Published 5 months ago

wi-library v1.2.20

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

W&I Library

This CSS library is meant to be used in conjunction with Compassion.com's Site MVP CSS

NOTE: As of update 1.2.0, elements and component stylings have been removed. Going forward, this library will be only used for grid and utilities.

Table of Contents

Settings

Settings are used throughout the library to populate color, grid, spacing, display and alignments options.

Breakpoints

The library comes with 6 distinct breakpoints. These breakpoints are used throughout the project for other tools, objects, components and utilities.

BreakpointREMPX
xs22.5rem360px
sm32.5rem520px
md45rem720px
lg62.5rem1000px
xl80rem1280px
xxl100rem1600px

Breakpoints are used as a modifier for other stylings. For instance, you may want to have an element show a different text color on mobile opposed to the desktop version. To do this, you would add the breakpoint modifier to the class.

<div class="text-white text-md-black"></div>

The above markup would show white text for devices under the md breakpoint width, but black text for devicdes over the md breakpoint width.


Colors

Below is a list of commonly used colors in the library that are used to transform backgrounds, typography and other color-related attributes.

namehex
#000000black#000000
#005eb8blue#005eb8
#F1F9FFblue100#F1F9FF
#D1E4F2blue200#D1E4F2
#4BA3E4blue500#4BA3E4
#00386dblue900#00386d
#20556Bdark-teal#20556B
#FFB500gold#FFB500
#425563gray#425563
#f9f9f9gray100#f9f9f9
#CCCCCCgray200#D8D8D8
#D8D8D8gray300#CCCCCC
#798894gray500#798894
#425563gray700#425563
#2F2F2Fgray900#2F2F2F
#88BE6Dgreen#88BE6D
#C13E2Dred#C13E2D
#0086BFteal#0086BF
#FFFFFFwhite#FFFFFF
#ffd100yellow#ffd100

Grid

Container

The container object is used to "contain" content within a bounds, and provide a gutters for the content.

<div class="container">
	...
</div>

This object has varients based on the breakpoint widths.

<!-- XL container-->
<div class="container-xl">
	...
</div>

<!-- LG container -->
<div class="container-lg">
	...
</div>

Row

This object is a flex container, intended for use in conjunction with the Container and Column objects.

<div class="row">
	...
</div>

Column

This object adds right and left gutters, while flexing to certain percantages of a base 12 grid.

<div class="row">
	<!-- Full width -->
	<div class="col-12">
		...
	</div>
</div>

The column can be adjusted based on particualr breakpoints. (See breakpoints)

<div class="row">
	<!-- Full width, then 4/12 width at medium viewport -->
	<div class="col-12 col-md-4">
		...
	</div>

	<!-- Full width, then 8/12 width at medium viewport -->
	<div class="col-12 col-md-8">
		...
	</div>
</div>

Utilities

Aspect Ratios

If you need an element to fit a certain aspect ratio, this is the utility for you. The class is formatted as such: aspect-{ratio}.

NameRatio
sqaure1:1
standard4:3
wide16:9
letterbox2.35:1
responsiveConforms to size of parent container.
<div class="aspect-square">
  <img src="{src}" alt="A sqaure image" />
</div>

<div class="aspect-wide aspect-md-responsive">
  <img src="{src}" alt="An image that is responsive above the md breakpoint and 16:9 below it." >
</div>

Background Colors

You can apply a background color to an element by giving it a class of bg-{colorName}.

<div class="bg-gray"><!--CONTENT HERE --></div>

The above markup would produce a <div> with a gray background. (See colors)

You may also set a background color to transparent by using the class name bg-transparent.

This can be modified by adding the breakpoint modifier to the class name. bg-md-gray would give a gray background to the element only at or above the md breakpoint. (See breakpoints)

This utility is able to be modified on hover of an element:

<div class="bg-blue hover:bg-blue900">Blue background that turns to dark blue on hover.</div>

Borders

Border Widths

You can apply a border color to an element by giving it a class of b-w-{borderWidth}.

<div class="b-w-1"></div>
namevalue
0border: 0
1border: 1px
2border: 2px
3border: 4px
4border: 8px

You can also select a certain side of the element to apply the border styling:

<div class="b-w-t-2"></div>
sidevalue
tborder-top: ###
rborder-right: ###
bborder-bottom: ###
lborder-left: ###

Border Colors

You can apply a border color to an element by giving it a class of b-c-{colorName}.

<div class="b-w-1 b-c-gray"></div>

The above markup would produce a <div> with a gray border color. (See colors)

Border Styles

This applies a border style to the element by giving it a class of b-s-{style}.

<div class="b-s-solid"></div>
style
none
dotted
dashed
solid
double

Rounded

<div class="rounded-1"></div>

Will set a rounded edge for the element.

namevalue
noneborder-radius: 0
1border-radius: .25rem
2border-radius: .5rem
3border-radius: 1rem
4border-radius: 2rem
circleborder-radius: 50%

Box Shadow

<div class="box-shadow-1"></div>

You can affect the box shadow property of an element by choosing an option below:

namevalue
nonebox-shadow: none
1box-shadow: 0 3px 6px rgba(0,0,0,.15)
2box-shadow: 0 3px 12px rgba(0,0,0,.15)
3box-shadow: 0 3px 25px rgba(0,0,0,.15)

Display

<!-- A link displayed as a block -->
<a class="d-block">Link</a>

You can modify the display property of an element by using on the following options:

namedescription
d-nonesets the display to none
d-blocksets the display to block
d-flexsets the display to flex
d-gridsets the display to grid
d-inlinesets the display to inline
d-inline-blocksets the display to inline-block
d-inline-flexsets the display to inline-flex
d-table-cellsets the display to table-cell
d-table-rowsets the display to table-row
<div class="d-none d-lg-block">Woot woot</div>

The above markup would be hidden for viewports below lg, but displayed as black for lg viewports and above.

Flex

Flex options can be modified.

Align Items

<div class="row align-items-center">
  <!-- FLEXED CONTENT -->
</div>
namedescription
align-items-centeralign items of flex container to center
align-items-flex-startalign items of flex container to beginning
align-items-flex-endalign-items of felx container to end

Align Self

<div class="row">
  <div class="col-12 align-self-center"></div>
</div>
namedescription
align-self-centeralign self to center
align-self-flex-startalign self to beginning
align-self-flex-endalign self to end

Flex Property

<div class="d-flex">
  <div class="flex-1">Flexed 1</div>
  <div class="flex-none">Flexed none</div>
</div>
namedescription
flex-1Sets the flex attribute to 1
flex-fullSets the flex to none and width to 100%
flex-autoSets the flex attribute to auto
flex-noneSets the flex attribute to none

Justify Content

<div class="row justify-content-center">
  <!-- FLEXED CONTENT -->
</div>
namedescription
justify-content-centerjustify content of flex container to center
justify-content-flex-startjustify content of flex container to beginning
justify-content-flex-endjustify content of felx container to end

Order

<div class="row">
  <!-- order-1 will be shown second -->
  <div class="col-6 order-1"></div>
  <!-- order-0 will be shown first -->
  <div class="col-6 order-0"></div>
</div>

The order of a flex container can be modified.

namedescription
0order will be set to 0
1order will be set to 1
2order will be set to 2
3order will be set to 3
4order will be set to 4
5order will be set to 5

Wrap

<div class="flex-nowrap"><!-- FLEX WILL NOT WRAP --></div>
namedescription
nowrapitems in flex box will not wrap
wrapitems in flex box will wrap (default)

Grid

Grid Template Columns

Sets the number of columns in the grid.

<div class="d-grid grid-cols-2">
  <div>Column width of 50%</div>
  <div>Column width of 50%</div>
</div>
namedescription
1100%
250%
333.333%
425%
520%

Grid Gap

Sets the gap between columns and rows.

<div class="d-grid grid-gap-2">
  <div>Gap of 1rem</div>
  <div>Gap of 1rem</div>
</div>

<div class="d-grid grid-cols-2 grid-gap-x-2">
  <div>Left and right gap of 1rem</div>
  <div>Left and right gap of 1rem</div>
</div>

<div class="d-grid grid-gap-y-2">
  <div>Bottom and top gap of 1rem</div>
  <div>Bottom and top gap of 1rem</div>
</div>
namedescription
00rem
1.5rem
21rem
31.5rem
42rem
55rem

Object

Set the object-fit and object-position attributes.

Object Fit

<img class="object-fit-cover" />
namedescription
containImage is contained within the bounds.
coverImage covers the bounds.
fillImage fills the bounds.

Object Position

Set the object-position attribute.

<img class="object-position-center" />
namedesciption
centerimage is at center
center-topimage is at horizontal center and vertical top
center-bottomimage is at horizontal center and veritcal bottom
leftimage is at left
left-centerimage is at horizontal left and vertical center
left-topimage is at horizontal left and veritcal top
left-bottomimage is at horizontal left and vertical bottom
rightimage is at right
right-centerimage is at horizontal right and vertical center
right-topimage is at horizontal right and vertical top
right-bottomimage is at horizontal right and vertical bottom

Overflow

Set the oveflow property of an element.

<div class="overflow-auto"></div>
namedescription
autosets the overflow property to auto
hiddensets the overflow property to hidden

Position

Set the positioning property of the element.

<div class="position-absolute"></div>
name
static
asbolute
fixed
relative
sticky
inherit

You can also adjust the top, left, right and bottom properties.

<div class="position-absolute top-0"></div>
<div class="position-absolute bottom-0"></div>
<div class="position-absolute left-0"></div>
<div class="position-absolute right-0"></div>
namevalue
n8-5rem
n7-4rem
n6-3rem
n5-2rem
n4-1rem
n3-.75rem
n2-.5rem
n1-.25rem
00rem
1.25rem
2.5rem
3.75rem
41rem
52rem
63rem
74rem
85rem

Spacing

Set padding and margins for an element.

Spacing Axis

namedescription
ttop
bbottom
tbtop and bottom
rright
lleft
rlright and left

Spacing Units

namevalue
00rem
1.25rem
2.5rem
3.75rem
41rem
52rem
63rem
74rem
85rem

Margin

<div class="m-2">
  <!-- ALL MARGIN AXIS ARE SET TO SPACING UNIT 2 -->
</div>
<div class="m-rl-2">
  <!-- MARGIN RIGHT AND LEFT SET TO SPACING UNIT 2 -->
</div>

You can also set margin to negative by adding an n modifier to the spacing unit number.

<div class="m-rl-n2">
  <!-- MARGIN RIGHT AND LEFT SET TO NEGATIVE SPACING UNIT 2 -->
</div>

Padding

<div class="p-rl-n2">
  <!-- PADDING RIGHT AND LEFT SET TO NEGATIVE SPACING UNIT 2 -->
</div>

Gutter

Gutter is the space between columns and the row.

namedescription
0row margin left and right of 0, column paddding left/right 0
1row margin left and right of -0.5rem, column padding left/right of 0.5rem
2row margin left and right of -1rem, column padding left/right of 1rem
3row margin left and right of -1.5rem, column padding left/right of 1.5rem
4row margin left and right of -2rem, column padding left/right of 2rem

Text

Font Family

Use this utility to update the element's font family attribute.

namedescription
sansThe theme's sans serif font, Montserrat
serifThe theme's serif font, Centruy

Text Alignment

namedescription
text-lefttext aligned left
text-centertext aligned center
text-righttext aligned right

Text Color

See color variables above for a complete list of colors.

<div class="text-blue">Blue text goes here.</div>

This utility is able to be modified on hover of an element with the hover: utility:

<div class="text-blue hover:text-blue900">Blue text that turns to dark blue on hover goes here.</div>

Text Decoration

namedescription
text-line-throughline through word
text-noneno text decoraitions
text-underlineunderline word

This utility is able to be modified on hover of an element:

<div class="text-none hover:text-underline">Text with no underline has an underline on hover</div>

Text Line Heights

namevalue
text-line-height-11em
text-line-height-21.3em
text-line-height-31.8em

Font Sizes

namevalue
text-1.875rem
text-21rem
text-31.25rem
text-41.5rem
text-51.75rem
text-62rem
text-72.5rem
text-83rem
text-94rem
text-105rem

Font Weights

namevalue
text-lighterfont-weight: 400
text-normalfont-weight: 500
text-boldfont-weight: 700
text-400font-weight: 400
text-500font-weight: 500
text-700font-weight: 700

Widths

You can adjust the width of an element with the class of w-{width}.

namevalue
autowidth: auto
2525%
5050%
7575%
100100%
100px100px
250px250px
500px500px
750px750px
1000px1000px

Z-Index

You can use a .z-{index} utliity class to adjust the z-index of the element.

value
0
1
10
20
30
40
50
<div class="z-0">z-index of 0</div>
<div class="z-10">z-index of 10</div>
1.2.20

5 months ago

1.2.18

11 months ago

1.2.19

8 months ago

1.2.16

11 months ago

1.2.17

11 months ago

1.2.9

1 year ago

1.2.12

1 year ago

1.2.13

12 months ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.14

12 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.0

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.4

2 years ago

1.2.2

2 years ago

1.1.3

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago