Cross-Browser Responsive Content with CSS Regions

In a recent post I described how you could use CSS Regions to easily create responsive content. One of the limitations mentioned though was that CSS Regions at present are natively supported only on Webkit nightly and Chrome Canary and Chrome Stable.

There is however the CSS Regions polyfill code up on GitHub to consider. I looked at that last year and it was a bit slow and problematic at the time.  It turns out though that there have been several improvements to the code in the interim and it works quite nicely and is quite performant now.  Let’s take a look…

Check out this Pen!

You can’t see it when the Codpen has been embedded in this post, but I’ve included cssregions.min.js in the JS tab.

Take a look at the CSS Tab.  Notice the new -adobe-flow-into and -adobe-flow-from CSS attributes:

#source {
  -adobe-flow-into: main-thread;
  -webkit-flow-into: main-thread;
  flow-into: main-thread;
}

.region {
  -adobe-flow-from: main-thread; 
  -webkit-fow-from: main-thread;
  flow-from: main-thread;
}

These new attributes are recognized by the polyfill.  They work the same as the -webkit-flow-into/from and flow-into/from attributes.  The polyfill code will detect and use any native implementations that exist so you don’t have to do anything special.  Everything should work exactly as it did before on WebKit and Chrome, but now it will also work on iOS4+, Android 4+, Firefox, Safari 5+, and Opera.   That’s right, mobile too!

Go ahead and view this post with the other browsers and devices listed above. The Codepen demo should work just fine (let me know if it doesn’t!).

Enjoy!

 

Tagged , , , . Bookmark the permalink.

2 Responses to Cross-Browser Responsive Content with CSS Regions

  1. Pingback: Responsive Content Using CSS Regions - Alan Greenblatt

  2. Pingback: CSS Regions | kulturbanause® blog

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>