
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
css-fx-layout
Advanced tools
This is a lightweight SCSS flexbox library. It is inspired by Angular's Flex-Layout and can replace the most popular functions of the (by now deprecated) Angular library.
This library gives you the option between using CSS classes or data-attributes. Both options give you the same features but the CSS classes can be more verbose when you want a more complex layout. Check out the Wiki for a detailed documentation.
Using the CSS classes is more verbose but the recommended way to use this library:
.fx-layout-
and .fx-align-
: CSS classes to control the flexbox container.fx-gap--
: CSS classes to add gaps between the elements in a flex container.show-
and .hide-
: CSS classes which can be used to show/hide elements depending on the screen size.fx-flex
and .fx-glex-grow
: Classes to control flex behaviour of an elementUsing the data attributes is the easiest way to use this library and easier to migrate to from Angular Flex-Layout:
data-layout
and data-layout-align
: HTML attributes to be used to control the flexbox containerdata-layout-gap
: attribute to add gaps between the elements in a flex containerdata-hide-
and data-show-
: attributes which can be used to show/hide elements depending on the screen sizedata-fx-flex
and data-fx-flex-grow
: Control flex behaviour of an elementThe library provides a responsive API which allows to create different layouts for different screen sizes using known breakpoints
like xs
, sm
, md
, lg
, xl
and including lt-
and gt-
variations of them. Please check out the Wiki
for details on how to use it.
All functionality is also available as mixins to accompany this library or to create your own customized selectors.
Add the library to your project's package.json
:
npm i -s css-fx-layout
Then use the provided mixins in your main stylesheet to include the css-fx-layout selectors. You can choose between using CSS classes or HTML data attributes (or, while not recommended, use both). If you want to use the layout-gap functionality you can customise which selectors are going to be generated by providing the start, end and unit as shown in the example below.
CSS Classes | HTML Data Attributes |
---|---|
|
|
These are some basic examples how to use css-fx-layout
. The file ./test/index.html
contains more examples.
This is the simplest example. It will make the div a flex container and align the three spans in a row:
CSS Classes | Data Attributes |
---|---|
|
|
The resulting layout:
An advanced example that aligns the items in reverse order with a gap of four pixels and vertically centered:
CSS Classes | Data Attributes |
---|---|
|
|
The resulting layout:
Vertically and horizontally center an element in its parent.
CSS Classes | Data Attributes |
---|---|
|
|
The resulting layout:
This will hide the first span on sm
sized screens and show the second span only on lg
sized screens. The third span is always visible.
CSS Classes | Data Attributes |
---|---|
|
|
There are no pre-compiled CSS files available for css-fx-layout 2 and above. Version 1 releases provided minified pre-compiled CSS files. If you are interested in them you can find and download them from the releases page.
Initially I created this library because I liked the convenient syntax of Angular Flex-Layout and wanted to use it in non-Angular projects and without JavaScript.
By now Angular Flex-Layout has been deprecated and this library can be a replacement for most of the popular parts.
2.1.0 (2023-01-03)
This release adds a responsive API including the commonly known breakpoint sizes of Flex Layout.
In order to use the default responsive API selectors please set the bool parameter of the mixins generating the selectors to true
(see the "Getting started"
in the README). It is disabled per default because it negatively affects the size of the generated code and not all projects
may need this.
.fx-flex
/data-fx-flex
if they are missingFAQs
A lightweight SCSS flexbox library inspired by Angular Flex-Layout.
The npm package css-fx-layout receives a total of 127 weekly downloads. As such, css-fx-layout popularity was classified as not popular.
We found that css-fx-layout demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.