| | |

Trying Flexbox at Casabona.Org

If you’ve visited Casabona.Org this week, you noticed that the homepage got a bit of a refresh; I decided to add more color, have more concise and focus content, and tried to give visitors an idea of what I do as soon as they get to the site. One new thing I tried was using the Flexbox Layout Module to layout the two-column area. Here’s how I’m handling it.

First if you need a primer, @chriscoyier has a fantastic Flexbox Guide on CSS Tricks. It’s not fully supported yet, but it’s a much easier way to lay out multi-column content without floats and hacks to fix height. While it’s not really a client site ready thing (at least not without proper fallbacks), I think you can get away with personal/experimental stuff.

Right now, if you are view this site in Chrome or Firefox (or allegedly IE11 but I didn’t see it there), you will see this two column layout:

Screenshot 2014-03-10 09.09.14

This is accomplished in a really simple fashion; it is one line of CSS! The container is an <aside> with the class .home, so the CSS looks like this:

aside.home {
   display: -ms-flexbox;
   display: -webkit-flex;
   display: flex;
}

This is going to handle everything. When you use display: flex (or its prefixed versions for IE10+/Safari), as Coyier points out, other styles like width and float are ignored. That means that on my site, a really nice fallback is naturally in place. If I do not apply a width to the child elements (which have a class of .widget), if Flexbox is not support, the user sees this:

Screenshot 2014-03-10 09.14.42

This isn’t exactly what I intended users to see, but this is a perfectly good fallback; most wouldn’t realize something was wrong at all and this is something I’m perfectly OK with. Plus, as more browsers add support for Flexbox, the site will adjust itself, without any intervention on my part. Yay progressive enhancement!

 

Similar Posts

  • |

    Cos Band Rocks

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! This site is finally launched! I have been waiting a while to finish it up and then make it live….

  • |

    Minimalist Task Management with Todo.txt Touch

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!Envato’s Android dedicated website, Android.appstorm.com, has published an article I wrote about Gina Trapani’s Todo.txt Touch android app. I cover the…

  • The Transition.

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!As it turns out, I hated the new layout, and am currently looking for inspiration on a new layout. If you…

  • |

    Simplecast Episodes Version 0.6

    Over the weekend I released Version 0.6 of my @simplecast plugin, Simplecast Episodes. Aside from some smaller internal changes, I added what I think is a pretty nice feature to coincide with WordPress 3.9’s new feature to create media playlists from audio and video: the ability to download episodes directly into WordPress, adding them to the…

  • | |

    Casabona.Org

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!The Official Launch! Im excited to announce, on June 1st, 2005- the official launch of Casabona.Org– a website I have been…

  • |

    Join Me for the 1st NEPA Hackathon!

    I’m happy to announce that I (with @nepawp) am working with @tecbridge1, and The University of Scranton ACM group to put on the first (of hopefully many) NEPA Hackathon! It will be held on May 11th, 2014 from 10am – 3pm at the Scranton Enterprise Center, at 201 Lackawanna Ave. Scranton, PA 18503.