A lightweight, zero-dependency CSS utility library for flexbox alignment. Easily align and distribute items in your layouts with simple, intuitive class names.
- ๐ Lightweight (less than 1KB minified)
- ๐ฆ Zero dependencies
- ๐ฏ Simple and intuitive class names
- ๐ง Covers all flexbox alignment properties
- ๐ฑ Works with any framework or vanilla HTML
- ๐จ Easy to integrate into existing projects
Include FlexAlign.css in your HTML using a CDN:
<!-- Full version -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/swapnilddixit91/flexalign-css@1.0.0/flexalign.css">
<!-- Minified version (recommended for production) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/swapnilddixit91/flexalign-css@1.0.0/flexalign.min.css">Install via npm:
npm install flexalign-cssThen import in your CSS or JavaScript:
@import 'flexalign-css';import 'flexalign-css';Download the flexalign.css or flexalign.min.css file and include it in your project:
<link rel="stylesheet" href="path/to/flexalign.min.css">Add the flex class to enable flexbox on a container, then use alignment utilities:
<div class="flex justify-center align-center">
<div>Centered content</div>
</div>| Class | CSS Property |
|---|---|
.flex |
display: flex |
.flex-inline |
display: inline-flex |
| Class | CSS Property | Description |
|---|---|---|
.justify-start |
justify-content: flex-start |
Align items to the left (start) |
.justify-end |
justify-content: flex-end |
Align items to the right (end) |
.justify-center |
justify-content: center |
Center items horizontally |
.justify-between |
justify-content: space-between |
Equal spacing between items |
.justify-around |
justify-content: space-around |
Equal spacing around items |
.justify-evenly |
justify-content: space-evenly |
Equal spacing between and around items |
| Class | CSS Property | Description |
|---|---|---|
.align-start |
align-items: flex-start |
Align items to the top (start) |
.align-end |
align-items: flex-end |
Align items to the bottom (end) |
.align-center |
align-items: center |
Center items vertically |
.align-stretch |
align-items: stretch |
Stretch items to fill container |
.align-baseline |
align-items: baseline |
Align items by their baseline |
| Class | CSS Property | Description |
|---|---|---|
.flex-row |
flex-direction: row |
Horizontal direction (default) |
.flex-row-reverse |
flex-direction: row-reverse |
Horizontal, reversed |
.flex-column |
flex-direction: column |
Vertical direction |
.flex-column-reverse |
flex-direction: column-reverse |
Vertical, reversed |
| Class | CSS Property | Description |
|---|---|---|
.flex-wrap |
flex-wrap: wrap |
Allow items to wrap |
.flex-nowrap |
flex-wrap: nowrap |
Prevent wrapping (default) |
.flex-wrap-reverse |
flex-wrap: wrap-reverse |
Wrap in reverse order |
<div class="flex justify-center align-center" style="height: 300px;">
<div>Perfectly centered!</div>
</div><div class="flex justify-between align-center">
<div>Left</div>
<div>Middle</div>
<div>Right</div>
</div><div class="flex flex-column align-center">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div><div class="flex flex-wrap justify-around">
<div class="card">Card 1</div>
<div class="card">Card 2</div>
<div class="card">Card 3</div>
</div>FlexAlign.css works in all modern browsers that support flexbox:
- Chrome 29+
- Firefox 28+
- Safari 9+
- Edge 12+
- Opera 17+
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see the LICENSE file for details.
- Initial release
- Core flexbox alignment utilities
- Justify content classes
- Align items classes
- Flex direction and wrap classes
Created and maintained by the FlexAlign CSS community.