Working as a freelance website coder for 10 years now, I’ve long gotten used to relying on the Internet to have my questions answered and problems solved.
Now, I’m pretty strict to myself at trying to do my code properly. For instance, I would never add in a tag attribute without putting quotes around the attribute (i.e., width=”20″ instead of width = 20). That was one of the first things I learned in college when I started studying HTML — luckily I had a C programmer for a teacher who taught me high standards for coding.
In the old days (well, within the last 5-15 years), just about everyone was using tables for layouts. It was pretty well the only way it could be done, and the table format was an ideal tool for producing complex layouts that were often demanded by graphic designers (sometimes they want things that are almost impossible).
Beginning around five years ago, though, was a new kind of movement to try to separate content from style. It may have been around for more than five years, but that was around the time I first started hearing about it. One of my clients had asked me to look into developing sites in XHTML for him, and learning how to do that led me down this path of discovery. It almost seemed like I was reading the writings of some new religion, with people getting angry and looking down on developers who were not following the rules of this new movement. One of the biggest things emphasized was that tables should not be used for layout, but for tabular data (an actual table found within the content, usually with borders and lines separating the cells).
I remember spending a lot of time trying to develop sites without using tables for layout. Sometimes I could do it, but if the design had a lot of complexity, or certain design elements, it was difficult to get rid of every table, so I just reduced them to as few as possible. When I encountered problems, I sometimes found solutions, but it usually involved writing a large amount of extra CSS, complete with hacks — something I’m really reluctant to do. After all, I was getting rid of some code by eliminating the extra code involved in creating at able, but actually adding a lot more code in the CSS. Was I really getting ahead?
So I started to get better at using floated DIV tags for layouts, and I started to get better at doing really complex layouts. It was a little better than using tables for layouts, for the most part. I admit, the code did look better, and my overall HTML page had less code, but what was I really doing that was different besides reducing the code in the HTML document. The DIV tags were still essentially cells, just like the table cells I used to use. I didn’t think it was really that much better, especially not a big enough improvement to warrant the insane amount of rebukes and fits I was seeing from the semantic fanatics.
For my navigation, I liked to just use a DIV tag to start it, such as <div id=”main-nav”>. It was so simple that way, and I could style all my links between the DIV tags almost any way I wanted. But I soon found out that even this was a problem for the semantic fanatics. They were preaching that navigation should be done using lists, and they were frothing at the mouth just as much as when they said tables shouldn’t be used for a layout. They said that a navigation is a list, so list tags (<ul><li>link</li></ul>) should be used.
Well, just like I didn’t switch to completely table-free sites, I didn’t start doing my navigations with lists. If I want to use them, I do, and if I don’t want to, I do not. However, this time, the semantic fanatics have a huge problem of inconsistency on their hands. On one side of their mouths, they tell people not to use tables for layouts, and on the other side, they tell people to use lists for navigation. Now what’s wrong with this picture? What’s wrong with it is that a navigation is not a list.
Lists have been found in HTML since the early days. They are used to list items in an orderly manner, such as a list of groceries, a list of symptoms of having a cold, or any other kind of list that the content requires. The key here is that it is used as part of the content. A navigation is not part of the content, but something outside of the content altogether.
So, isn’t it a bit strange for the semantic fanatics to say:
- Tables should not be used for layout, because they were never intended for layout, but for tabular data in the content
and then say
- Lists should be used for navigation.
Shouldn’t they be saying
- Lists should not be used for navigation, because they were never intended for navigation, but for lists of items in the content
In this case they are seriously contradicting themselves. Can you say double standard? Very foolish.
In conclusion, I would just like to say that it is a good idea not to take the semantic fanatics too seriously. We should strive to code as well as we possible, and it is probably best to follow XHTML standards to make sure our tags are closed and attributes are all in quotes. Other than that, I say it’s up to you to decide what works best for your site. Don’t spend a ton of extra hours trying to get rid of all your tables, use a table for layout if you want, but only if absolutely necessary, and either do or do not use a list for your navigation. Good luck with your coding!