A portion of what we do as web designers involves arranging elements horizontally or vertically on the screen. As of yet, CSS lacks a suitable mechanism for this task. Enter CSS3 Flexible Box Module (“Flexbox” for short).
Flexbox is one of three W3C draft specs (as of this writing) dealing with general layout issues and has its strengths and weaknesses compared to the other two. But as it has already been implemented in Firefox (and I predict there is a good chance it will be implemented in Safari in some form), you might want to play around with it. Even if it doesn’t get implemented in anything other than Firefox, some of the principles regarding flexible available space have already been injected into the other modules. Plus, it’s pretty fun.
The draft describes Flexbox as:
[...] a CSS box model optimized for interface design. It provides an additional layout system alongside the ones already in CSS. [CSS21] In this new box model, the children of a box are laid out either horizontally or vertically, and unused space can be assigned to a particular child or distributed among the children by assignment of “flex” to the children that should expand. Nesting of these boxes (horizontal inside vertical, or vertical inside horizontal) can be used to build layouts in two dimensions. This model is based on the box model in the XUL user-interface language used for the user interface of many Mozilla-based applications (such as Firefox).
This is pretty clear. It implies two important things:
- No more abusing floats, and no more getting abused by floats
- We can create true flexible layouts, and the browser will do the calculations for us
Basically, Flexbox is a small part of XUL ported to CSS. Cool as it may be, I remain of the opinion that the power of Flexbox is in the layout of things like UI components (think forms and toolbars and such) rather than in general page layout. So let’s not get carried away and make Flexbox the new float. For general page layout, we need a true grid-based model; I’ll come back to that in the near future. For now, let’s dive in.
Flexbox gives us a new value for the display property (the box value), and eight new properties:
- box-orient
- box-flex
- box-align
- box-direction
- box-flex-group
- box-lines
- box-ordinal-group
- box-pack
Today, we’ll ease into this and just focus on box-orient and box-flex, and tackle the other properties in Part 2.
Let’s say we have three paragraphs, each of which introduces one of three product lines for a client website. Our designer has determined that these teaser paragraphs are to be placed adjacent to one another along a horizontal axis, essentially forming three columns.
<div id="products">
<p id="phones">First child</p>
<p id="computers">Second child</p>
<p id="fast-cars">Third child</p>
</div>
How would you currently tackle this? Most, without thinking, would simply float these paragraphs, perhaps adding overflow:hidden; to the parent in order to clear the floats. Nothing very special. But we could also do it quite easily with Flexbox:
#products {
display: box;
box-orient: horizontal;
}
In the above code, we’re simply telling the parent to behave according to this (flex)box model, and to lay out all its children along the horizontal axis. No floats. Yay.
box-orient accepts four values, but two of them are important for all intents and purposes: horizontal and vertical. Self-explanatory.
The widths of the children remain as specified (or their inherent width if not specified). This means that if the total widths of all the children is less than the total width of the parent, we’ll get something like this:

But what if you wanted paragraphs one and two to have specific widths and paragraph three to adjust itself depending on the available space within the parent? Flexbox to the rescue:
#products {
display: box;
box-orient: horizontal;
}
#fast-cars {
box-flex: 1;
}
Here, we’re telling the last child to become flexible, and to take up available space. Since we’ve only allocated space to one element, it will take up all of the available space:

Note that the element only becomes flexible along the orientation axis of the box; in this case the element becomes flexible horizontally.
The value for box-flex is relative. So if we were to make the second and third children flexible:
#products {
display: box;
box-orient: horizontal;
}
#computers {
box-flex: 1;
}
#fast-cars {
box-flex: 1;
}
These would each take up the same amount of available space, in fact dividing the available space equally between them.

Should we give the last child box-flex: 3;, then it would take three times as much available space as the second child.
Check out the demo (this will only work in Firefox) or download the demo source code (.zip-file, 1kB).
Without even considering the other six properties, there are lots of possibilities here. Although I am not in favor of using this module for page layout, it can be done, as you can see in the demo.
We’ll get back to the other properties at a later date. In the meantime, if you want to play around with this, why not? It will only work in Firefox work in Firefox and (newer) webkit browsers; just prefix the display value and properties with -moz- or -webkit- respectively:
display: -moz-box;-moz-box-orient-moz-box-flexdisplay: -webkit-box;-webkit-box-orient-webkit-box-flex
Please be advised: this is meant to be a surface-level introduction to a draft spec. At the time of this writing, most people won’t find this applicable to anything outside of experimentation. There is, however, value in learning about the content of somewhat lesser-known working drafts, if only to be able to compare one to another.
Enjoy!
Praise be to Karen McGrane, who dared to defend Lorem Ipsum. Her article couldn’t be more timely, as the festering sore that is the Cult of Content-is-King-and-Design-is-Just-a-Decorative-Sauce-on-the-Content-Entree has started to bleed profusely. And it’s pissing me off. As is the alarming thought trend that all deliverables should mimic the final product.
On content
Content is important. After all, it’s content people who come up with job titles like Content Strategist, which pretty much means One Who Thinks About Content. Which content, for whom, when, where, why, how… It’s absolutely necessary, because clients don’t do it. Not at the level that it should be done.
Paul Rand, one of the most well-respected designers this world has seen, called design “a method of putting form and content together”. If you would agree with this statement (as I do), you can infer the role of the designer as the one who must successfully combine two components: form and content (the designer will first busy herself with the form component). These two are not mutually exclusive. They are separate components which share a common goal and should be developed on a parallel track to one another. This, however, does not mean that they should be reviewed by the client together at every stage.
On clients
Two quick facts about clients:
- Many don’t know what they want, and when they do, they don’t know how to communicate it
- Many lack the imagination to “see through” design sketches
These are the reasons we are hired in the first place. But these two facts have paved a dangerous path across the lawn of the creative process. An alarming number of web professionals today seem to advocate making preliminary deliverables mimic the finished product– the more accurate, the better.
This is, well, stupid.
It’s not stupid if don’t track your hours. It’s not stupid if you don’t care if or how much you are paid for your work. It isn’t stupid if you don’t mind doing twice as much work for nothing. Your clients will love you for it, and you’ll be doomed to continue doing it for the rest of your career.
On designing in the browser
When Andy Clarke first started talking about “designing in the browser”, I thought it was a great idea. Then people started misinterpreting this to mean “executing the creative process in the browser”. If Andy really designed in the browser, his designs would be shit. What he was of course referring to was the execution of a design idea in the browser as opposed to a tool like Photoshop, which doesn’t communicate Web Things the way a browser does. He strives for more realism in his deliverables. He’s simply working based on the two Client Truths listed above. And if you’ve ever done designs in Photoshop, you’ll know that applying client changes to those documents is akin to cutting off your own fingers one knuckle at at time. HTML is much easier.
That said, there is certainly a place for Photoshop sketches. It’s possible to put together a quick visual impression of a website in far less time than it would take to work out in HTML. I’m referring to the basic idea of a website, an impression of the design language, intended to gauge if we are on the write track before spending many more hours mocking things up in HTML, which is, in fact, templating. I am not referring to creating finished static design visuals. These are the bane of the web designer’s existence, and should be avoided at all costs. If you really understand your client’s needs, that means you’ve done your homework, and you’ve actually designed before the browser. Otherwise: baby steps.
On communication
Imagine that your job was to drive your client somewhere. They aren’t quite sure where they want to go, but a lot of sun would be nice. And perhaps water. You could drive them to California, but once they hear about Florida, they might prefer that and demand that you drive them there (at your cost, because you’re the one who chose to go ahead and drive to California).
A better way would be to communicate with the client, asking them if they prefer dry heat or humidity, surfing or Spring Break parties, earthquakes or hurricanes. Based on this information, you could show and tell about both places, help them weigh the pros and cons, and help them in their decision. Then drive. Only then.
Making websites is a process. Creativity is a process. Pacing and leading clients is a process. You’re not going to eliminate frustration by trying to come up with real content, a polished design and working browser functionality on the first go. You will lose money, though, and perhaps your sanity.
There’s a reason for storyboards. But wait, shouldn’t Pixar just go ahead and build and render the complete movie so that the studio execs can see how it will really look?. Then, if they like it, it’s done! Yeah, right. Good luck with that.
There’s a reason that advertising teams consist of an art director and a copywriter: design and content. They’re bed buddies. But these teams pitch ideas, and then work them out. That’s why we have wireframes. That’s why we have Photoshop. That’s why we have Lorem Ipsum. And that’s why we have, most importantly, good old pencil and paper.
On balance
Here’s what I think: some web professionals want to focus more on deliverables than on people. But guess what: it’s all about people. We need to help our clients along and communicate with them. If you want good deliverables the first time around, the answer is not to use “real” content and a design which is in fact finished HTML/CSS/Javascript in a real browser. The answer is to ask focused questions, discover the pressing problems, to introduce your client to your potential solutions to those problems. Give them tidbits: here’s an impression of how the site could look visually. Here are some things you might want to consider concerning your content. Work your way up to real content in a real browser. When done right, that point can come quickly.
It’s too much to show a client all these things at once in the very beginning. There are too many factors, and it’s impossible to tell which factors will influence their opinions at that moment, which makes revision a nightmare at best. Of course content and form should each be developed with the other in mind. But consider presenting separately at first. Yes, that could mean that Lorem Ipsum is an option. That could mean that Photoshop is an option. That could mean that a sketch on a napkin, with a good, old-fashioned explanation of how things work, is an option. When you know enough, put form and content together.
On bed buddies
And forget the content versus design war. They need each other. In the words of Paul Rand, “when form predominates, meaning is blunted. but when content predominates, interest lags.”
2010: Let’s get this party started
Man, 2009 was a tough year. I’ve had some rough years this past decade, but 2009 really did its best to piss me off, and was creative about it. Running a company (a web company) didn’t make things much easier. Luckily, the intense focus on getting stuff done paid off for work, but was personally exhausting.
Some good things past
2009 certainly wasn’t all bad. There were plenty of good things. Vacation here in Holland with the kids and having my sister over to visit was fantastic, as was our week in Portugal (it was my first time there and I loved it.
I finally started understanding that doing some nice things for myself is a good thing, not selfish, and very necessary. I still didn’t do enough it, though. This website still needs a design. At least that design is coming along nicely.
If the worst problems in life are people problems, then the opposite is also true: the best moments are people moments. People who inspire, make you laugh, people you can have fun with. (Fun. Hmmm. Need more of that this year.)
There were some great people moments in 2009. Great personal, family moments, but also new contacts and friendships. I’ve also had the pleasure of meeting, becoming friends with and even working with some of the finest minds in web development. People who inspire me and make me want to become better at what I do. You know who you are. And last but not least my team at Cinnamon; we spend almost every day together and despite ups and downs, we still worked hard to kick web ass for our clients.
I didn’t do a lot of speaking last year, but I was glad to be a part of the events where I did speak. I was honored to have been invited to speak about CSS3 layout at Fronteers in Amsterdam. Grip2009, the workshop event that Cinnamon and Eend hosted, was a success and a pleasure to do.
Some good things to come
There are so many cool things going on in web development right now, and so many things I’d like to do. That’s my problem, as those who know me well have witnessed: too many interests. Trying to whittle them down to something manageable is futile.
I won’t pretend I will have the time or inclination to do everything I want to do this year, but I’ll be happy to get any of them done. These are not New Year’s resolutions; I never finish those. These are simply some of the things I’d like to do, accomplish or work on this year (aside from the usual stuff like running a company and having a family):
- I’d like to evangelize CSS3 layout even more, through writing, screencasts and speaking engagements. As a matter of fact, I’m enjoying speaking and would like to do more of that as well.
- This website needs a design, badly.
- There are a couple of really cool projects I’m planning with really cool people which are still non-public. I’d like to work on these and make them known.
- I want to finish the book proposal I started more than five years ago.
- I’d like to start training martial arts again, so my body doesn’t always feel like I’ve been hit by a truck.
- Exotic vacations, become rich, have nice cars… oh, wait. Got carried away for a minute.
- Be as prolific and productive as Chris Heilmann. Or half. Or a third.
I could go on and on, but trust me, it would hog some serious bandwidth.
Most of all, I want to do what I love, to look on the bright side of things, to see possibilities, to enjoy my friends and family, to have some fun, and to do it all in good health.
I wish you the same.