By Peter Bell

What is a Website Made of?

As part of my recent foray into CSS, I spent some time looking at the last 40 sites I've developed. A few were for direct clients, most were from one of our three primary design partners we worked with while we were developing SystemsForge. I found that from a semantic perspective there tended to be a pretty small number of common "container" elements we could have used to build almost all of the sites . . .

I think it is important to start by (somewhat arbitrarily) distinguishing websites from web portals. I'm not talking for the moment about portal style sites with multiple independent components on the page, but rather the content management and e-commerce workflow sites that are so common with most Small to Mid-sized Business front facing websites.

In looking at the vast majority of sites we developed, you could consider them as being comprised of the following CSS containers:

  • Page - For a number of CSS techniques it is often useful to have an overall parent div for the entire page.
  • Header - Most sites have some kind of header with a logo, maybe a sales message, sometimes ancillary navigation (shopping cart link, etc) and sometimes a login pod.
  • Primary Navigation - Most sites then have some form of primary navigation - whether as part of the topbar (possibly with drop down menus for sub links) or as a left or right sidebar (possibly with fly out menus for sub links - sometimes with expanding menus for showing sub page links).
  • Secondary Navigation - Some sites has secondary navigation for providing access to the pages within a section. The most common implementation of this uses a topbar for the "section" links with a different set of sidebar links for each section.
  • Primary Content Area - Most sites could be described as having a primary content area that contains the content for the primary page feature - whether it be an article detail or a list of products.
  • Secondary Content Area - Many sites have an additional secondary content area on a subset of pages - often with different content on different pages. Most common is a right hand sidebar with (say) a list of testimonials on th home page and in the about us section, with a list of potential cross sells when displaying a product catalog or cart, with a cart while shopping or even with tertiary page specific navigation, such as a list of states while looking at a store locator. Sometime the secondary content area relates to the information being displayed in the primary content area - at other times it is independent of it.
  • Footer - Most sites have some kind of message at the bottom together with navigation that mirrors primary navigation and/or provides access to additional content like privacy policies and site maps.

Some notes are in order:
Firstly, there is occasionally tertiary navigation - perhaps a site with a topbar, sidebar, and then tabs within the content area. We choose to treat such tab based tertiary navigation as a page feature dealt with in the content area, allowing some pages to display tabs linking to all of the sub pages in the site map.
Secondly, there are definitely sites that don't follow this pattern - just not many of them in the kind of applications we develop.

I love the idea of semantic names such as primary and secondary navigation (as opposed to say "topbar"" denoting header plus primary nav and "sidebar" denoting secondary nav). It also makes it much easier to change decisions like the positioning of the primary and secondary nav with either no or minimal changes to the mark up (depending on the CSS used, you might need to change the order of the containing divs).

The biggest problem I have with semantic names for such content areas is where the client is thinking "sidebar" and on some pages that'll be navigation and on others it'll be a picture of an attorney and a list of their practice areas. I suppose one approach to that it to have additional divs that appear/disappear (just using server side logic although I supposed we could .hide() them if we wanted to) so that on one page there would be a secondary nav which makes up the sidebar and on another it might be called "attorney-details".

Hmm, so, what questions do I have for you?! Firstly, how often do you find such a convention would work for the sites you build? Secondly, what are some of the cases where this doesn't fit so well? Thirdly, do you use CSS that allows you to vary position independently of the order of the main container divs or do you prefer simpler floating which could potentially rely on div order to some extent? And of course, any other thoughts?

Related Blog Entries

Comments
"Firstly, how often do you find such a convention would work for the sites you build? "

For front-facing websites, I'd say this works > 90% of the time. (At least based on our clients)

"Secondly, what are some of the cases where this doesn't fit so well? "

When the client wants something really artsy, we've had trouble fitting the code to it (as in, "modifications need to be made", not "we can't do that"). I'm not sure how much of it fit conceptually but not physically. All of it is a small sample though.

"Thirdly, do you use CSS that allows you to vary position independently of the order of the main container divs or do you prefer simpler floating which could potentially rely on div order to some extent?"

I don't answer this question in practice often, as I'm normally working with someone else's CSS. Based on that experience, I'd say the answer is the ever dependable "it depends." What are the goals you are trying to accomplish with the layout? I'd probably opt for relative position by default and move to absolute if I needed to. Print designers probably feel the opposite. (Or, when what want to accomplish simply won't work with movable and/or resizable containers)
# Posted By Sammy Larbi | 9/10/07 7:46 AM
A lot of people are confused about id vs. class.
<div id="nav"> should be used instead of <div class="nav"> even though they could both accomplish the same thing.
I like your idea of having
<div id="primarycontent"> and <div id="secondarycontent"> instead of
<div class="content"> and another <div class="content">
# Posted By Phillip Senn | 9/12/07 5:05 PM
Hi Phillip, I agree 100% - these are unique one off containers, so ID is more appropriate. Classes are better for items where you could conceivably have n-per page.
# Posted By Peter Bell | 9/12/07 5:48 PM
Hey Peter!
Check out
http://www.aacr9.com/index/coldfusion/kuler

I worked on it late last night from Ray's kuler.cfc demo.
# Posted By Phillip Senn | 9/14/07 12:34 PM
I'm getting an error message :-<


Error Occurred While Processing Request
Element RSS.CHANNEL.RECORDCOUNT.XMLTEXT is undefined in XMLRESULT.

The error occurred in C:\Websites\73172bkj\Index\ColdFusion\Kuler\kuler.cfc: line 78
Called from C:\Websites\73172bkj\Index\ColdFusion\Kuler\kuler.cfc: line 25
Called from C:\Websites\73172bkj\Index\ColdFusion\Kuler\kuler.cfc: line 32
Called from C:\Websites\73172bkj\Index\ColdFusion\Kuler\Application.cfc: line 8
Called from C:\Websites\73172bkj\Index\ColdFusion\Kuler\Application.cfc: line 14

76 :    <cfhttp url="#arguments.myurl#" result="result">
77 :    <cfset xmlresult = xmlparse(result.filecontent)>
78 :    <cfset totaltheme = xmlresult.rss.channel.recordCount.xmlText>
# Posted By Peter Bell | 9/14/07 9:18 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.