Using CSS Regions as an Enhancement
If you were not aware of them CSS Regions are proposal to CSS3 that would allow for some magazine like layouts in HTML pages. Adobe has been leading the charge on getting them into WebKit. They are currently available in Chrome. (Also I think IE10)
Now the way they work:
- You create a bit of content in an element like an article
- You designate that article as the source of a “flow”
- You designate other elements as the recipients of the “flow” (We’ll call them “regions”)
Then when the browser renders the content
- The element designated as the “flow” is not shown
- The content of the “flow” pours into the “regions”
Assuming this HTML:
And this CSS:
You get something like this:

I have a demo. It only works in Chrome. Resize the screen to see the flowing of the content.
I was presenting on them the other night and I got asked a pretty good question.
Have you thought about how these degrade?
I made a bad joke, then mumbled something about if the browser doesn’t support CSS Regions then the original “flow” element gets displayed and all is well.
I tested it today. And all is not well. Because I still created those region elements. And they show up down at the bottom and add whitespace.
Check out the demo on any browser bu Chrome and you’ll see what I’m talking about all the way at the bottom.
So after some experimentation I decided that the best way to handle this was to create my four regions with CSS exactly how I had but only inject the region holders if the browser supports regions, like so:
Here’s a demo of the improved version.
In this case, I get a much better experience for non Chrome users–no weird mile of whitespace at the bottom of the content.
About Terry Ryan
Terry Ryan is a Worldwide Developer Evangelist for Adobe. The job basically entails helping developers using Adobe technologies to be successful. His focus is on web and mobile technologies including expertise in both Flash and HTML. Previous to that, he spent a decade working in various technical roles at the Wharton School at the University of Pennsylvania.
Terry is also the author of Driving Technical Change, a Pragmatic Bookshelf title. It's about convincing reluctant co-workers to adopt new tools and ideas.
He blogs at http://terrenceryan.com/blog and is tpryan on Twitter.
More About Terry »Northern Virginia Software Symposium
November 1 - 3, 2013
Reston, VA
Current Topics on the NFJS Tour
- Core Java, JEE
- Dynamic Languages: Groovy, JRuby, Scala, Clojure
- RESTful Web Apps
- Frameworks: Hibernate, Grails, Spring, JSF, GWT, more
- Agility
- Test Driven Design
- Security
- Ajax, Flex, RIA
Why Attend the NFJS Tour?
- » Cutting-Edge Technologies
- » Agile Practices
- » Peer Exchange
Current Topics:
- Languages on the JVM: Scala, Groovy, Clojure
- Enterprise Java
- Core Java, Java 7
- Agility
- Testing: Geb, Spock, Easyb
- REST
- NoSQL: MongoDB, Cassandra
- Hadoop
- Spring 3
- Automation Tools: Git, Hudson, Sonar
- HTML5, Ajax, jQuery, Usability
- Mobile Applications - iPhone and Android
- More...
NFJS, the Magazine
May Issue Now AvailableOn the road to learning
by Raju GandhiRefactoring to Modularity
by Kirk KnoernschildRESTful Groovy
by Kenneth KousenGetting Started with D3.js
by Brian Sletten