CSS-Element-Queries
Element responsiveness for a modern web

An event-based CSS element dimension query library with valid CSS selector syntax to change styles and allow responsive images based on element's dimensions and not window's viewport.

It's exactly what we need when it comes to responsive Web Components.

Installation

Download

Current Version: 1.2.1
Download the zip file using the buttons on the right side and include both files at the head section of your page. ElementQueries start automatically to listen to window.load event and parses all available css files to attach the ResizeSensor and start the magic.

NPM

npm install css-element-queries --save

Highlights

 

Examples
Drag the gray line at the right to see it in action.

Responsive Text

Element responsiveness FTW!

Responsive Image

The image above has a default of 700px. Shrink or expend the container too see responsive image working. Thanks @placehold.it

Responsive Widget

Demo 1

This is content from the first responsive demo without media queries. It uses the element queries provided by this library.

Responsive Layout

Demo 2

Box
First 1/2 box
Second 1/2 box

Responsive Animation

Demo 3 - width

This box is animated through css transitions. We attached a resize-listener to this box. See below.
No changes.

Demo 4 - height

This box is animated through css transitions. We attached a resize-listener to this box. See below.
No changes.

ResizeSensor Demo

0 changes
CSS-Element-Queries comes with a Javascript ResizeSensor class you can use in Javascript directly.

Performance Demo

Performance Test: