Jonathan Snook has written a great post that I have commented as a “succint statement of validation” regarding the over/use of DIV’s in a web site.
Like many coders who layout their plans on paper first, I carefully decide what the DIVs will be entitled for the remainder of their lifetime online.
Some have standard names like #header and #footer, whereas some have names specific to their content: #flickr and #delicious. It makes sense, and helps me to remember and search within my own code. A good designer will understand that reasoning.
Interestingly, I have seen (cough yes I read your HTML cough) a lot of HTML that has DIV’s named such strange names: “#part_one, #part_two, etc” or “#A001, #A002“.
This might work for the designer who believes he/she will be the first and last person to EVER maintain that site: But what if you intend to give the client ownership of the site and the ability to amend their own code? Or you are an employee of a large corporation – and you leave?
Therefore it is a great idea to name DIV’s that others will understand.
There are many articles around the net that suggest that <!– commenting –> is the ideal way to assist when others are editing your work: I concur. But don’t overdo it.
There are other interesting sites that include such comments as <!– Herein lies the CSS and HTML of Roger Rabbit. Don’t rip, steal, crack or break it. –>. Stupid really. That’s just inviting the inevitable. And how the hell are you going to police it?
Jonathan’s post originated from Nate Koechley’s article on a similar vein, also very interesting reading on the subject. Nate talks of an error that I was doing in my early days: “… each ‘paragraph’ of content in a <div class=”p”> element … ” Doh! Not a good idea.
I found that blogger allowed no other option. Thankfully I now understand the error of my way and know how to beat that problem.
But enough about bad history. The future is here. And DIV’s are here to stay.
Discover more from The Entrepreneurial Life of Stephen Mitchell
Subscribe to get the latest posts sent to your email.