Back when we were looking at layout blocks done with pencil and paper, I explained that the outer rectangle we were designing within was the containing block. In print design, the containing block is a physical object like a business card or a billboard. On the Web, our container is the browser window. Should the design fill the browser window, or should it have a set width? This decision is one that has plagued web designers for hundreds, if not thousands of years — all the way back to the days when we used tables and
spacer.gif
files to lay out web page content. Okay, maybe not thousands of years ago, but this is a long-standing debate nonetheless.Fixed Width
If you’ve started your layout with the 960 Grid System that I talked about earlier, chances are you’re working toward a fixed-width layout. These designs are wrapped with adiv
that’s given a pixel-based width (say, 960 pixels), and centered within the body tag using margin: 0 auto;
. If the browser window is wider than 960 pixels, you’ll see the body
element’s background to the left and right of the container; and if
it’s narrower, you’ll have a horizontal scrollbar. Fixed-width layouts
are easier to design for — and maintain — because you’re essentially
building exactly what you design in Photoshop or your design program of
choice. The graphic below shows a similar layout structure as fixed and
as fluid in the same width of browser space:Fluid Width
A fluid or liquid layout is designed with percentage-based widths, so that the container stretches when you resize the browser window. These take more thought to plan, as you have to foresee problems that might occur at every possible width. Sometimes pixel-width columns are mixed with percentage-based columns in a fluid layout, but the idea is to show the user as much horizontal content as will fit on their screen. Typically, fluid layouts take advantage of themin-width
and max-width
properties of CSS, ensuring the container doesn’t become ridiculously narrow or wide.One reason some designers reject fluid layouts is because they think it impedes them using a grid to create their designs. There are several resources available for designing fluid layouts on a grid, including a fluid adaptation of the 960 Grid System. Ultimately, though, the decision to use one type of layout over the other should really be determined by the target audience, and the accessibility goals of each individual website. The pros and cons of each layout type are fairly well-defined, as the table below outlines:
Pros | Cons | |
---|---|---|
Fixed width |
|
|
Liquid width |
|
|
An Alternative: Responsive Layouts
It’s been said that for every rule, there’s an exception. That’s usually true in the web world, and designers have come up with many variants and hybrids of fixed-width and fluid-width layout structures. I’ve seen articles recently that list up to ten different layout types. For the purpose of this chapter, however, most of those could be categorized as either fixed or fluid. On A List Apart article, though, introduced a novel layout type that I think we’ll be seeing a lot more of. The article was titled “Responsive Web Design” and it was written by Ethan Marcotte.Rather than repeat the entire article here, I highly recommend that you check it out. If I had to name this layout technique myself, I would call it the Omnipotent Mercury Morphing Methodology, but that’s probably why I didn’t come up with it. The idea is that as the mobile market makes browser window widths more and more inconsistent, the need for our layouts to be fluid and adapt to different widths is increasingly vital. The technique takes advantage of some fancy fluid scaling and CSS3 media queries to completely change the layout as it hits certain width thresholds. The graphic below shows screenshots of Ethan’s example at three different browser widths.
Ethan’s responsive web design (or Omnipotent Mercury Morphing Methodology) is a great solution to a problem we’ve yet to discuss: screen resolutions, which we’ll look at next.
Resizing: Fixed, Fluid, or Responsive Layouts
Reviewed by JohnBlogger
on
1:24 PM
Rating:
No comments: