• Stars
    star
    4,326
  • Rank 9,942 (Top 0.2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A JavaScript polyfill for Flexbox

flexibility

Flexibility Logo

A JavaScript polyfill for Flexbox

npm bower ci gitter

Flexibility is a polyfill for the Flexible Box Layout, commonly known as Flexbox. With Flexibility, you get to design beautiful, flexible layouts on the web without sacrificing the experience in older browsers.

Flexbox lays out, aligns, and distributes elements in a container, even when their size is unknown or dynamic. To better understand Flexbox, read Chris Coyierโ€™s excellent Complete Guide to Flexbox.

To start using Flexbox in Internet Explorer 8 & 9 or any older browser, download the flexibility.js script and include it anywhere on your page.

<script src="flexibility.js"></script>

If youโ€™re only targeting Internet Explorer 10 and lower, add a -js-display: flex declaration before any display: flex declarations in your CSS, or use PostCSS Flexibility to automate this during your build process.

.container {
	-js-display: flex;
	display: flex;
}

If youโ€™re targeting other browsers, use the data-style attribute to alert these browsers to your changes.

<div data-style="display: flex;"></div>

When youโ€™re ready to polyfill flexbox with JavaScript, use the flexibility method on the outermost element you would like to polyfill.

flexibility(document.documentElement);

API

The global flexibility method contains child functions for use within your own framework.

flexibility.read

Argument: Element

Return flexbox related styles from an element.

flexibility.readAll

Argument: Element

Return a list of flexbox details from a matching element or its descendants.

flexibility.write

Argument: Details

Writes flexbox details back to their respective elements.

flexibility.writeAll

Argument: Array

Writes a list of flexbox details back to their respective elements.


To learn more about Flexibility, read the support section.

If you experience an issue, read the contributing section before creating an issue.

More Repositories

1

svg4everybody

Use external SVG spritemaps today
JavaScript
3,290
star
2

closest

Return the closest element matching a selector up the DOM tree
JavaScript
353
star
3

media-player

A tiny, totally cross browser, accessible, fully customizable media player
JavaScript
271
star
4

fitie

An object-fit polyfill for Internet Explorer
JavaScript
211
star
5

EventListener

EventListener Polyfill for IE
JavaScript
149
star
6

http-client-hints

Hurray for server-side content negotiation
PHP
128
star
7

google-fonts-complete

A complete list of Google Web Fonts and their sources
JavaScript
118
star
8

MediaClass

Javascript-Powered Cross-browser Media Queries and Events
JavaScript
111
star
9

wp-svg-spritemap

Use SVGs in WordPress โ€” Manage an SVG spritemap
JavaScript
104
star
10

html5-invoice

Creates invoices on the fly, anywhere, without any additional software.
JavaScript
80
star
11

convert-colors

Convert Colors converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more
JavaScript
75
star
12

posthtml-inline-assets

Inline external scripts, styles, and images in HTML
HTML
62
star
13

array-flat-polyfill

A polyfill for Array.prototype.flat and Array.prototype.flatMap
JavaScript
57
star
14

color-names

Many, many names of colors
56
star
15

document-promises

Document loading states as Promises
HTML
53
star
16

regexp-escape

Escape strings for use within a regular expression
JavaScript
52
star
17

dsc

A 0.3kB JavaScript library for creating DOM structures (JSX compatible, JSDOM compatible)
JavaScript
46
star
18

css-font-weight-names

A JSON Object of css font weight names mapped to their numeric font weight value
45
star
19

browserstack-app

BrowserStack client for Windows, Mac, and Linux
JavaScript
38
star
20

usestate-js

React useState in vanilla JavaScript
JavaScript
37
star
21

viewsource

Yo dawg, we heard you like viewing the source, so we put our source in the source so you can view source while you view source.
PHP
29
star
22

element-qsa-scope

Return elements matching a selector relative to the current node
JavaScript
29
star
23

closest-color

Get the closest color
HTML
26
star
24

Polyfills-for-IE8

Please move to https://github.com/jonathantneal/polyfill
JavaScript
25
star
25

posthtml-md

Easily use context-sensitive markdown within HTML
JavaScript
25
star
26

posthtml-aria-tabs

Write accessible tabs with minimal markup
JavaScript
23
star
27

posthtml-schemas

Add schema.org microdata to your markup super easy
JavaScript
21
star
28

layout-webfont

A tiny "no space" font designed for inline-block layouts
19
star
29

mdcss-theme-github

GitHub theme for mdcss
JavaScript
18
star
30

post-npm-install

npm install when package.json dependencies have changed post-merge
JavaScript
18
star
31

preloadfill

A polyfill for the preload link type [rel="preload"]
JavaScript
17
star
32

hfill

A speculative polyfill to use the h element in HTML
JavaScript
16
star
33

angular-sticky

Keep any element on your page visible
14
star
34

wget.sh

A cloud-based app installer
Ruby
14
star
35

website-checklist

All those things to remember, all those questions to ask.
12
star
36

upsite

Just put up a site
JavaScript
12
star
37

rat

The results of how different markup is read by accessible technology
HTML
12
star
38

watch-size

Watch the size changes of a DOM element
JavaScript
10
star
39

h-element-spec

Use contextual headings in HTML
HTML
10
star
40

readase

Read Adobe Swatch (ASE) files
JavaScript
10
star
41

match-media-range

Use ranges in media queries passed to window.matchMedia
JavaScript
10
star
42

practical-styles

A collection of meaningful properties and functional classes designed to help you write cleaner, scalable, and easier to maintain CSS
CSS
10
star
43

html5shim

HTML5 Shim: a javascript compatibility workaround for Internet Explorer <9 and the display of HTML5 elements.
JavaScript
10
star
44

dom-create-node

Creates DOM Nodes from a CSS Selectors
JavaScript
8
star
45

scrollr

WebKit-based touch scroller
JavaScript
8
star
46

AudioContext

AudioContext Polyfill
JavaScript
8
star
47

rapid

A simple tool for rapidly creating components
JavaScript
8
star
48

mdcss-theme

A boilerplate for mdcss themes
JavaScript
8
star
49

httpe

An http & https compatible module. Simultanious ports & protocols. Set & generate certificates & charsets & mimetypes. Glob & chain requests. Stream & process files.
JavaScript
8
star
50

Cross-Browser-CSS3-Rule-Generator

Generates cross-browser CSS3 rules
8
star
51

practical-custom-selectors

realistic and reusable custom selectors
CSS
8
star
52

soberatio

Go home, aspect ratios. Youโ€™re drunk.
7
star
53

postcss-wp

Generate WordPress PHP files from CSS files
JavaScript
7
star
54

astro-with-postcss

CSS
7
star
55

svgc

Convert SVG spritemaps into CSS stylesheets
JavaScript
7
star
56

event-observer

Treat DOM events like Arrays
JavaScript
7
star
57

eslit

Write templates with embedded JavaScript expressions
JavaScript
7
star
58

media-expressions-spec

Use media queries within values in CSS
HTML
6
star
59

harmonize.css

A presentational layer
6
star
60

posthtml-lorem

Add lorem ipsum placeholder text to any document
JavaScript
6
star
61

screenplay.css

CSS for Brilliant Screenplays
6
star
62

custom-elements-module

A recompiled polyfill for HTML Custom Elements
JavaScript
6
star
63

element-merge

Merge the contents of 2 DOM elements
JavaScript
5
star
64

html5css

A stylesheet of the HTML5 Presentational Requirements and Recommendations from the spec
5
star
65

keyboard-focus

Detect when an element has received focus from a keyboard
JavaScript
5
star
66

storybook-addon-css-user-prefs

wip addon for storybook
TypeScript
5
star
67

jshtml

A javascript templating system for browsers and nodejs
JavaScript
5
star
68

domose

Old Fashioned DOM Sugar
JavaScript
5
star
69

nextjs-with-cqfill

Demo of NextJS with CQFill
CSS
4
star
70

carousel

A tiny, highly accessible, easily customizable carousel
JavaScript
4
star
71

urlicon

beautifies web address inputs with informative glyphs and tastefully recomposed urls
JavaScript
4
star
72

babel-plugin-transform-globals

Transform global variables in JavaScript
JavaScript
4
star
73

stylelint-config-dev

A shareable configuration package for stylelint
CSS
4
star
74

reshape-md

Use Markdown in HTML
JavaScript
4
star
75

parent-node-replace-all

Remove all child nodes from a ParentNode while allowing the insertion of a new set of nodes
JavaScript
4
star
76

countries

Useful information about every country, packaged as objects
PHP
4
star
77

directory-fonts-complete

Generate a complete list of fonts and their sources from a directory
JavaScript
4
star
78

babel-plugin-jsx-imports

Automatically add the necessary imports when a file contains JSX
JavaScript
4
star
79

jshape

Shape any value in JavaScript
JavaScript
3
star
80

reshape-tape

Quickly test Reshape plugins
JavaScript
3
star
81

hitch-element-queries

Proposed Element Query syntax realized in Hitch
JavaScript
3
star
82

this-is-a11y

Accessible markup for the web
HTML
3
star
83

marble-css

A set of UI components behind Electric and WeDeploy.
CSS
3
star
84

console

A console for old Internet Explorer
JavaScript
3
star
85

parse-yaml

zero-dependency module for parsing YAML and Front Matter
JavaScript
3
star
86

posthtml-plugin-boilerplate

Create new PostHTML plugins
JavaScript
3
star
87

mdn-browser-compat-lite

A smaller version of mdn-browser-compat-data, with only the essentials!
JavaScript
3
star
88

babel-plugin-func-wrap

Wrap the whole script in a function โ€” export as CommonJS, ES Modules, IIFE, or a global variable
JavaScript
3
star
89

astro-youtube-component

Astro YouTube Component
CSS
3
star
90

js-focus-ring

Deliver a consistent focus experience to browsers
JavaScript
3
star
91

astro-module-html

JavaScript
3
star
92

css-media-interface-style-test

Test media at-rule with color-scheme
JavaScript
3
star
93

kcc

Map key codes to codes in JavaScript
JavaScript
3
star
94

ok

super fast bash shortcuts
Shell
3
star
95

normalize

CSS
3
star
96

bootstrap-fonts-complete

A complete list of Bootstrap Fonts and their sources
3
star
97

astro-css-units

JavaScript
2
star
98

astro-stitches

Astro
2
star
99

astro-cqfill

Astro + Container Queries
CSS
2
star
100

vvssl

A command line utility to quickly setup https for any Vagrant site
JavaScript
2
star