ireckon blog

our team offer up their best tips and words of wisdom

Ireckon.com Web Design Brisbane Australia

August 2008

The elusive DIV

Posted by: David on 12 Aug 2008 @ 5:32 pm Category: Web Design

Well this will be my first blog post with Ireckon. I’ve been pondering on what would be my most insightful topic as a web designer in my first few weeks at Ireckon.

After some thought, the conclusion was the DIV tag.

Famed for revolutionising web design by making the good ol' table layout method redundant. But it is not without its woes.

Divs are a way to contain information, and style them. They are the bricks and mortar of a website. The problem lies most often when tackling large pages of information. A rogue closing DIV tags gets lost, and in turn the page breaks.

An example:

 



In the example above, we see a typical end to a XHTML page with a lot of closing DIV tags. It's hard to know what closing DIV is what. It is here that things can get messy if an extra closing tag finds its way into your markup. It happened to me the other day! Quite often an easy fix, but occasionally can become the frustration of the day. Especially if the problem spans across several pages.

So how do we stop this from happening?

Quite often it comes down to the care taken in writing your markup. Well structured and neat code will win the race.

Back to our example with some effective structural and commented additions:



Add plenty of comments to your markup. It will help keep your code legible and easy to navigate, not only for yourself, but other users/colleagues too.

There is no sure way to protect your code from breaking. The web is a fickle place. Magnificent that it is.

Preventative measures like solid, clean structure and taking care when writing your markup will work wonders.

Comments

Leave a comment

Enter code you see in image

Web Developement Blogs - BlogCatalog Blog Directory