A recent post to a newsgroup I visit, CIWAH, sparked a small yet interesting debate concerning the differences and similarities between semantic and presentational markup in HTML. Daniel Tobias started the ball rolling with a short piece that covers a few of the well worn points in this discussion. The article however does reinforce the need for people to understand what they are writing and not to abuse tags in a meaningless fashion.
In response to Dan’s post a more interesting point was raised by Jukka K. Korpela when he stated that:
Physical markup does not define the semantic meaning (except in the trivial sense where we might say that the visual presentation isthe meaning), but it may carry a connotation, at least when taken in context.
In the discussion of logical vs presentational I think that the point Jukka makes is important, as well as one that is often glossed over by proponents of semantic markup. Recognising that web based content may be delivered in varied contexts, and demonstrating that semantic markup is the best method for making this delivering in varied contexts is a key method of convincing web developers to use semantic markup.
An example of why semantic markup is important may be found in this post itself, when quoting Jukka’s post I added structural HTML constructs to give emphasis to certain words. In many browsers these ephasised words will appear in boldface or italics, how can non-visual browsers pass this information onto their users? Well first of all I have used <strong> and <em> tags to markup the emphasis rather than <b> or <i> tags, because the tags I used are defined semantically the relationship between the differently emphasised words is clear, and an aural browser will be able to easily pass on this information. In contrast the tags that merely make the text boldfaced or italicised have no defined relationship with each other and is open to differing interpretation, by using semantic tags the relative importance of the words is effectively gagued and can be taken into account during the presentation of the content.
The example I have given demonstrates one advantage semantic (logical) markup has over presentational markup, an enumeration of the arguments supporting semantic markup has been proposed as:
- Logical markup can be mapped to varying physical presentations depending on presentation medium.
- Logical markup can be automatically processed in a manner that is based on the defined logical meanings of elements.
- Logical markup leads to more flexible ways of affecting the visual presentation and creating alternative presentations.