3.0.0 • Published 6 years ago

@makay/flexbox v3.0.0

Weekly downloads
25
License
ISC
Repository
github
Last release
6 years ago

@makay/flexbox

npm (scoped) license

Tiny flexbox library (1.65KB gzipped) to help you build responsive layouts quickly and without writing any CSS.

Goals of this library:

  • To expose most of flexbox's properties as human-readable CSS classes.
  • To not change any properties of classes/elements outside the library.
  • To be able to be used alongside other CSS libraries and frameworks without breaking anything*.
  • To be as small as possible while still achieving all the previous goals.

* There might be collisions with the class names of some libraries or frameworks (like Bootstrap's ".row"). If possible, exclude the grid systems offered by these as you will not be needing them anyway. If you really have to keep them, make sure this library is loaded after them and things might still work for the most part.

What is flexbox?

Flexbox provides tools to allow rapid creation of complex, flexible layouts, and features that historically proved difficult with CSS. [Source]

If you're unfamiliar with flexbox be sure to take a look at the following resources (in no specific order):

Installation

npm (recommended)

Run npm install @makay/flexbox or yarn add @makay/flexbox to install the latest version.

Include node_modules/@makay/flexbox/flexbox.css or node_modules/@makay/flexbox/flexbox.min.css in your bundle using your preferred bundler.

CDN

Include one of the following stylesheets in your page:

https://cdn.jsdelivr.net/npm/@makay/flexbox@3.0.0/flexbox.css

https://cdn.jsdelivr.net/npm/@makay/flexbox@3.0.0/flexbox.min.css

Documentation

After installing the library, you can start using it by adding the classes listed below to the elements of your page.

Container classes

ClassCSS properties
rowdisplay: flex;flex-shrink: 0;flex-direction: row;
columndisplay: flex;flex-shrink: 0;flex-direction: column;

Container modifiers

ClassCSS properties
reverseflex-direction: row-reverse;orflex-direction: column-reverse;
shrinkflex-shrink: 1;
wrap-reverseflex-wrap: wrap-reverse;
wrapflex-wrap: wrap;
nowrapflex-wrap: nowrap;
align-startalign-items: flex-start;
align-centeralign-items: center;
align-endalign-items: flex-end;
align-baselinealign-items: baseline;
align-stretchalign-items: stretch;
align-content-startalign-content: flex-start;
align-content-centeralign-content: center;
align-content-endalign-content: flex-end;
align-content-stretchalign-content: stretch;
align-content-space-betweenalign-content: space-between;
align-content-space-aroundalign-content: space-around;
justify-startjustify-content: flex-start;
justify-centerjustify-content: center;
justify-endjustify-content: flex-end;
justify-space-betweenjustify-content: space-between;
justify-space-aroundjustify-content: space-around;

Child classes

ClassCSS properties
(any)max-width: 100%;
align-self-autoalign-self: auto;
align-self-startalign-self: flex-start;
align-self-centeralign-self: center;
align-self-endalign-self: flex-end;
align-self-baselinealign-self: baseline;
align-self-stretchalign-self: stretch;
flex-noneflex: none;
flexflex-grow: 1;
flex-Xflex-basis: calc(X*100%/12);

*X can range from 1 to 12, inclusive.*

Child media queries

Classmax-widthCSS properties
flex-lg-X1199pxflex-basis: calc(X*100%/12);
flex-md-X991pxflex-basis: calc(X*100%/12);
flex-sm-X767pxflex-basis: calc(X*100%/12);
flex-xs-X575pxflex-basis: calc(X*100%/12);

*X can range from 1 to 12, inclusive.*

Utility classes

ClassCSS properties
paddedpadding: 16px;
hiddendisplay: none;

Utility media queries

Classmax-widthCSS properties
hidden-lg1199pxdisplay: none;
hidden-md991pxdisplay: none;
hidden-sm767pxdisplay: none;
hidden-xs575pxdisplay: none;
Classmin-widthCSS properties
hidden-gt-lg1200pxdisplay: none;
hidden-gt-md992pxdisplay: none;
hidden-gt-sm768pxdisplay: none;
hidden-gt-xs576pxdisplay: none;

Contribute!

Found an issue or want to add a new feature? Feel free to open an issue or make a pull request!

3.0.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

7 years ago