Home

Awesome

Flexie enables the 2009 Flexbox model. You're probably looking for the updated spec. There is currently no polyfill for the new spec.*

* I've been working on one in my off-time. It's a beast.

Cross-browser support for the CSS3 Flexible Box Model. Check out The Playground to see it in action.

Flexie v1.0.3

Browser Support

The Flexible Box Model is supported natively by these browsers:

In addition, Flexie attempts to normailze browser inconsistencies with the flexible box model.

Currently Supported Properties

Why?

I really wanted to use the CSS3 Flexible Box Model.

How?

It works like Selectivizr. In fact, it uses Selectivizr's engine to traverse your style sheets and looks for display: box elements. After that, it looks for any of the currently supported properties.

Note: Flexie looks for non-vendor-prefixed properties. For example, it will ignore -moz-box-pack, but not box-pack. For best results, make sure to use a non-vendor-prefixed property in addition to your prefixed properties. But you were already doing that to future-proof your code, weren't you?

No setup on your end, just stick Flexie in your markup after your selector engine of choice.

Requirements

See the things you need to know

Caveats

Asynchronous API

You can run Flexie asynchronously in case you cannot purely on style sheets. All parameters are optional, unless otherwise stated:

Creating a new Flexie Object

var box = new Flexie.box({
	target : document.getElementById("foo"),
	orient : "horizontal",
	align : "stretch",
	direction : "normal",
	pack : "start",
	flexMatrix : [1, 1, 1, 1],
	ordinalMatrix : [0, 0, 0, 0]
});

Flexie.updateInstance(target, params)

Used to redraw currently active Flexie objects (i.e., after dynamically updating a flexbox element). All parameters optional.

Note: Calling this method without parameters will update all instances.

Flexie.getInstance(target)

Returns the target instance

Flexie.destroyInstance(target)

Destroys the target instance.

Note: Calling this method without parameters will destroy all instances.

Flexie.flexboxSupported

An exposed object detailing the level of flexbox support. Returns false for no support.

Acknowledgements

Selectivizr, for their fantastic CSS parsing engine.

Copyright and Software License

The MIT License

Copyright (c) 2010 Richard Herrera

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contact

Links