HTML5 and CSS3: Wireframing in the final product

It’s a classic case of Photoshop versus website. Existing wireframing and prototyping tools are incapable of accurately reflecting the environment of the web.

They produce static designs that can’t be seen through the variable known as the web browser. And when you build the final website, some elements won’t look exactly like their draft counterparts, and the client will notice those minor differences in fonts, positioning, etc.

You may be more comfortable with a graphics program, and rendering the design iterations may seem to take longer if you have to hand-code the HTML.

However, the advantages of creating a wireframe in HTML from the start are beginning to outweigh the alternatives: not only do we have new layout elements in HTML5 and more powerful selectors and styling in CSS3, but by combining them, we can throw together a simple layout quickly.

We’re hearing a new company every day (37Signals, Atomiq and others) explain its adoption of HTML prototyping. Their main reason is that the process is surprisingly easy when you have the right tools in place. You’re about to learn how easy this process can be, and when you’re done, you’ll have a head start on your next build.

 

Quick layout with HTML5

HTML5 brings a set of excellent new structural elements that make it easier to quickly mock up a document with fewer classes and ids. Once you understand the purpose of these elements, you will be able to create a rough page layout in minutes.

If you’re unfamiliar with these new elements, here’s a quick introduction. The new elements provide a cleaner document structure than before, while freeing you to move away from a heavy use of divs. Lachlan Hunt describes these elements nicely in “A Preview of HTML5”:

  • The article element represents an independent section of a document, page or website. It is suitable for content such as news and blog posts, forum posts and individual comments.
  • The section element represents a generic section of a document or application, such as a chapter.
  • The header element represents the header of a section. Headers can contain more than just the section’s heading; for example, it would be reasonable to include sub-headings, version history information and bylines.
  • The nav element represents a section of navigation links. It is suitable for both website navigation and a table of contents.
  • The aside element is for content that is tangentially related to the content around it, and it is useful for marking up sidebars.
  • The footer element represents the footer of a section. It typically contains details about that section such as the author’s name, links to related documents and copyright data.

In my example website, I want a centered page, with a header, a sidebar on the left, an area for the main content and a footer. I’ve used HTML5 elements to mark up the structure, with an article element to contain everything.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Example</title>
</head>
<body>
  <article>
    <header></header>>
    <article>
      <aside></aside>
      <section></section>
    </article>
    <footer></footer>
  </article>
</body>
</html>

These elements and divs are dimensionless and invisible unless you set style attributes or place content in them. To make them workable, we need to temporarily assign heights to them. We should also set the HTML elements to display: block; so that the browser recognizes them (extra work is required for IE).

article, header, nav, aside, section, footer {
display: block;
min-height: 100px; }

Before positioning the elements, we need to be able to visualize the layout. The ideal solution for visualizing the structure without any content would be easy to remove later and would not affect the design.


Option 1: Outlines

The outline setting is compatible with all modern browsers and does not affect the width of elements, whereas the border attribute does.

article, header, nav, aside, section, footer {
outline: 1px solid #000; }
Wireframing HTML with CSS Outlines

Option 2: HSLa

HSLa (or even RGBa) gives you a better representation of the hierarchy of elements because the opacity will make overlapping elements appear darker. But if you plan to have basic background colors in the mock-up, then this method may not work well.

article, header, nav, aside, section, footer {
background: hsla(200, 30%, 30%, .4); }
Wireframing HTML with CSS3 HSLa

Positioning

The method for positioning elements is a matter of personal preference, and you have plenty of options: measuring tools in the browser or operating system, background grid images (which I’ve chosen), CSS frameworks with grid and layout assistance, or software like Dreamweaver. Positioning is the most important part and will need to work properly from the beginning. The code you write here will most likely remain in the final product.

In my example, I’ve given the page a fixed width, with a sidebar on the left and content on the right, both between the header and footer.

body > article {
width: 760px;
margin: 0 auto; }

article article {
overflow: hidden;
width: 750px;
margin: 20px 0;
padding: 5px; }

aside {
width: 150px;
float: left; }

section {
float: right;
width: 590px; }

Throughout the entire process, I am able to see each section and see where it will appear. Here is the result:

Wireframing HTML with CSS Outlines Wireframing HTML with CSS3 HSLa

Don’t worry about browser compatibility until you get to the final product. I strongly recommend leaving notes via CSS comments, marking which areas you need to come back to (which will primarily be the selectors and attributes that require additional care for certain browsers).

 

Prototyping content

When the layout is complete, you may need to add sample content. The most common method today is to throw chunks of Lorem Ipsum and watermarked stock photography onto the page. Why reinvent the wheel?

HTML Ipsum is an excellent website that wraps Lorem Ipsum text in common mark-up. Being able to grab everything on one page couldn’t be any easier.

HTML-Ipsum

PlaceHold.it offers placeholder images at any size you need by calling each image via a URL request (such as http://placehold.it/350x150, where the first value is the width and the second the height):

Placehold.it Placeholder Example


PlaceKitten works exactly like PlaceHold.it, except with cuter images:

Placekitten Placeholder Example

Rather than adding advanced JavaScript for maps, you can pull in a basic map as an image via Google Static Maps. An API key or unique signature is required, but you’ll have to get that anyway if the final product will contain a map.

 

Simulating behavior

Modern websites contain functionality that is difficult to communicate through static wireframes: expanding and collapsing elements, transitions, drag and drop, dynamic menus, etc. You’ll have to use a JavaScript library eventually anyway, so loading a library now and scripting in some basic functionality wouldn’t hurt.

You can avoid a download by loading jQuery from its content network. Mimic the intended behavior with a few functions instead of writing the actual code. For example, if an element should appear when a link is clicked (say, a log-in window or contact form), then build a quick wireframe of the window, hide it by default, and then use jQuery to reveal it on click.

As long as you do just enough work to mimic the behavior, the client will be able to see the result for themselves, rather than having to pour over a series of flow charts or explanations.

 

Simulating states

If you’re creating wireframes for a web application rather than a website, you may want to be able to quickly show several states of a single page. You could create different copies of the wireframe, each altered to show a particular state, or you could use PolyPage.

PolyPage is a jQuery plug-in that enables you to use classes in your mark-up to represent elements that would be present for different states (for example, logged in and logged out). You can toggle each state with a link, thus helping you easily demo the differences to the client without needing several pages.

 

Final thoughts

While the original designs always look gorgeous on paper or in PDF, building the HTML pages right from the start has several advantages.

You save the time that you would have spent recreating the design in code. You avoid the confusion of wondering why the final product does not look exactly like the original. And you save both you and the client time, money and nerves.


Michael Botsko is a web developer and web technology instructor in Portland, Oregon. He enjoys working on both client and open-source projects with Botsko.net, LLC. When not working, he enjoys spending time with his two children and wonderful wife.

Which rapid layout and prototyping tools have I overlooked? What are the benefits of designing first and building later?

0 shares
  • http://twitter.com/vijeesh_vj VJ

    good article really helful !!

  • http://twitter.com/samdbeckham Sam Beckham

    Not a bad idea, I’m not sure I’ll be implementing it just yet though as I’m too used to Photoshop but it’s definitely something to bare in mind.

  • http://twitter.com/swaver28 Swati Verma

    Nice!

  • http://profiles.google.com/tyleregeto Tyler Egeto

    Small correction to the article, Google Static Maps does not require an API Key or unique signature. PlaceKitten is awesome.

  • http://twitter.com/virgomaldives virgomaldives

    Very informative i should consider it.

  • http://www.techexplorer.in Jal Desai

    Brilliantly written article. Wireframing is one of the basic tasks and the steps you mentioned will really help in developing an advanced site with HTML5 and CSS3

  • http://profiles.google.com/ss.jatinmehta Jatin Mehta

    Awesome. Thanks for such a nice article.

  • http://www.facebook.com/rajrana1972 Raj Rana

    cool!

  • Martin Kool

    Hey Michael, awesome post. HTML prototyping has been a vital gap in the web development process for a long time, good to see so many people pick it up and talk about how to do it properly.

    Personally, I’ve been trying to close that gap (Jussi mentioned livejs in the comments already, it’s indeed one of our small contributions to closing that gap). One thing I’d love to discuss with you is Handcraft (dotcom). Not to plug it, but it’s built from the ground up around the design-in-the-browser philosophy that backs up HTML prototyping.

    If you want, ping me at @mrtnkl to discuss. I would love to hear from you.

  • http://twitter.com/Remus_life Remus

    You are an error in your code.

    >

    but nice post

  • http://www.adeepbite.com/ Zinedine Zidane

    was looing for this. Thanks for sharing.

  • Anonymous

    Thanks for this! Just learning HTML 5 now :P

  • http://ashish4design.wordpress.com Ashish

    Very nice article.
    This is really helpful to know the new deferent tags of HTML 5 and it’s uses.
    Thanks for this.

  • http://www.myvouchercodes.co.uk/discounts/johnlewis.com John Lewis Sales

    HTML5 will replace flash real soon

  • http://tobto.org/ tobto

    great useful tutorial!

  • http://tobto.org/ tobto

    great useful tutorial!

  • http://tobto.org/ tobto

    great useful tutorial!

  • Giuseppe Beghelli

    Excellent article. HTML5 is the future and we must begin to know

  • Giuseppe Beghelli

    Excellent article. HTML5 is the future and we must begin to know

  • Anonymous

    typo, page 1 line 9