written on:24 Jun, 2008 by Alen Grakalic
CSS do's and dont's Part 2- Markup
Delicious | Digg | Stumble | Reddit | Float | Subscribe to RSS Feed
If you truly get into web standards you'll soon find out that the most important thing is - markup. A good, solid, well structured markup. Html, XTHML, tags, attributes, structure... That's what it's all about actually. We tie in the terms CSS and web standards. Term CSS has become almost a synonym for standards. I often use the term "css designer" or "css this", "css that" to quickly explain what methods and approach I am talking about. But the real truth is, CSS would mean NOTHING if your markup structure is wrong. Markup is the king.
Structuring a document
The key to web standards compliant document is it's structure. It must be meaningful and logical. Document should follow a certain flow and it must be readable and understandable without any css styling.
Most documents have different sections (navigation, main content, side content, copyright area, contact area etc.) User, human or non-human. should be able to understand those sections as well as sections importance from the first look at it. The most important section should be as high up in the flow as possible, but importance of a certain section is also defined with heading tags (h1, h2, h3, h4, h5, h6). In a way headings define documents structure.
Structural and Presentational Tags
In web standards world you often hear a syntagm "separating presentation from content". What does it mean? Basically it means that no html elements should exist for presentation purpose only. You should try to avoid having empty divs for drop shadows or something similar. Let all your markup has its structural meaning and exist as a logical part of a document.
Tag choices
There are many tags to choose from and you should embrace that variety. Don't rely on divs alone for container elements. Sometimes a simple paragraph with some child spans or ems is enough to get what you want. We all use ordered and unordered lists, but we also have another type of lists that I don't see used that often - definition list. DL is ideal in many cases because of it's "2-dimensional" structure. Also why not use ADDRESS tag for contact info that we place in a footer? Take a pick!
Validation
Validation has its importance in analyzing your code. But validating alone doesn't mean that your document is built according to standards. You can have entire document made of divs with class names. That would validate, but would it be meaningful? Not to everyone, and certainly not to search engines.
Do
- pay extra attention to document's structure. It's the most important thing.
- think semantics, use tags in a meaningful order, create a logical html "flow".
- use variety of tags, choose appropriate one for a certain type of content.
- well, practice... try to think outside the box in order to achieve certain effect.
- try to use as few html elements as possible for the same design effect, you'll feel better about yourself.
- compromise in terms of design. Well up to a certain point that is. Sometimes it's better not to use certain design effect and have cleaner markup.
Don't
- think that if something is valid it is automatically web standards compliant.
- overuse certain tags, like divs.
- use presentational tags, or at least keep it to the minimum.
- don't avoid using certain elements thinking that they are not "web standards" (yes, I am talking about tables).
- compromise in terms of markup.
About the author:
Designer, developer and a passionate standardista with large experience in all types of front-end work. Started to get involved with web in 1999. and turned freelance in 2005., the same year he started Css Globe. Alen's work has been featured on numerous css galleries including famous Css Zen Garden official list. Available for contract work.
Enjoyed the article?
Subscribe to our RSS feed or share it with your friends.
Delicious | Digg | Stumble | Reddit | Float | Subscribe to RSS Feed
Comments
Subscribe
Join 5000+ subscribers and receive our content instantly.
Follow us on Twitter
Want to be the first to know when a new article is published?
Sponsors

Look Professional with FreshBooks

Sitegrinder 2 Photoshop Plugin
Recent Articles
- Purist or a Freak
- CSS do's and dont's Part 2- Markup
- Easiest Tooltip and Image Preview Using jQuery
- 4 Uber Cool Css Techniques For Links
- CSS do's and dont's Part 1: CSS Selecting




Daniel Nielsen on 24 Jun, 2008 wrote:
Peter Benoit on 24 Jun, 2008 wrote:
Mark Creative on 24 Jun, 2008 wrote:
Does it annoy anyone when larger and supposedly 'better' design agencies still design sites in tables and charge a lot more ?
Jitendra Vyas on 25 Jun, 2008 wrote:
Drew on 27 Jun, 2008 wrote:
"don't avoid using certain elements thinking that they are not "web standards" (yes, I am talking about tables)."
Tables should be used for displaying tabular data, thats it. No exceptions. Using tables for a site layout is an extremely unnecessary use of precious bandwidth, I dont think clients will appreciate you using more bandwidth and memory than necessary.
Tables are for tabular data NOT design.
Thanks for the article.
Regards,
Drew
cssglobe on 28 Jun, 2008 wrote:
Of course tables are not meant for site structure. Actually I was referring to developers who avoid using tables all together even when it comes to tabular data. I went through that phase myself, I coded calendars with lists etc.
Daniel Nielsen on 29 Jun, 2008 wrote:
I have always used tabels alot in the past, too much I would say. So I have never understood why to make a tabular list with anything else.
/Pardon my english
Drew on 29 Jun, 2008 wrote:
"Actually I was referring to developers who avoid using tables all together even when it comes to tabular data"
Just wanted to say that I obviously misunderstood what you were trying to say originally, glad we agree about no tables for design.
Best Regards,
Drew
Welcome to Paradise on 4 Jul, 2008 wrote:
JaJa on 8 Jul, 2008 wrote:
Not the best argument I have heard for not using tables. I am not saying that we should use tables for layout, but bandwidth is not all that precious anymore.
============================
"Do compromise in terms of design...Sometimes it's better not to use certain design effect and have cleaner markup."
This sounds like someone who doesn't work with real clients. I have never met a client that cared about cleaner markup, but many, many clients want their cool design effect. Maybe it is different where I live (San Francisco), but the clients here are very needy when it comes to design.
Drew Douglass on 9 Jul, 2008 wrote:
Hi JaJa,
I feel I took this post a little off topic as tables for design (or lack thereof) was not the original topic for this post. However, I must respectfully disagree with your conclusion about bandwidth. It may not be precious to a very small or personal website, but tell a large corporation or client of yours that an unnecessary amount of his/her bandwidth is being used and see how they react. I really cant see the point in wasting bandwidth by using tables for a layout when one has the wonderful world of CSS.
Again sorry to be so off topic.
Best Regards,
Drew
Leon P on 9 Jul, 2008 wrote:
From a designer's point of view it makes perfect sense to design in this way: a logically-structured document should result in a logical information architecture. In this sense the web is not a visual medium at all.
Erik Pettersson on 10 Jul, 2008 wrote:
Kudos on 16 Jul, 2008 wrote:
As the web shifts towards stricter standards compliance, the number of "designers" floating around wanting to do things their own way and the wrong way is high. Too many folk want web design to be art, when it will never be so.
Tomas Liubinas on 30 Jul, 2008 wrote:
tom on 5 Aug, 2008 wrote:
ale on 6 Aug, 2008 wrote:
jessabean on 9 Aug, 2008 wrote:
I wrote a post about designers/developers who go overboard in the vilification of tables and linked to this article.
The web standards/tables debate
Wardell on 17 Aug, 2008 wrote:
Romy on 21 Aug, 2008 wrote:
I completely agree that tables should be used for tabular data display only and not for whole webpage design.