View Full Version : Semantic code
francis
20th Dec 2003, 01:09 pm
Some of the more geek/nerd (what's the difference? I did find out that the word Nerd first orginated in a Dr Seuss book...) people who care about coding may have heard the word "semantic" being bandied about of late. Wassat? Basically it's trying to use the correct piece of X/HTML to describe the contents contained within it. So, for instance, a page heading should (I feel), be wrapped in a <h1> tag, an unordered list should be coded using <ul> blah[/list] and not a sucession of
elements. Designed a web page and want to put your details on it? That's what the <address> tag is for.
There's plenty of discussion around this on the Web. This SimpleQuiz (http://www.simplebits.com/tips/simplequiz/) discussion I found this morning might prove usefull/insightful to some. It seems to be an ongoing document, so could be worth keeping an eye on.
Tom
22nd Dec 2003, 08:21 am
Best to read Uncle Tim's article in Scientific American on this important topic The Semantic Web (http://www.sciam.com/article.cfm?articleID=00048144-10D2-1C70-84A9809EC588EF21&ref=sciam). A semantic web is achieved by coding, but coding for the sake of information, not coding for the sake of good style. Semantic, by the way, means 'of or relating to the study of meaning and changes of meaning'.
David
22nd Dec 2003, 09:11 am
My Collins dictionary gives the meaning of semantic as "of or relating to meaning or arising from distinctions between the meanings of different words or symbols". For 'symbols' read 'tags' and you place the meaning in a web coding context.
Debate about correct semantic code is a big issue at the moment and it's not difficult to understand why.
In the days of HTML (before CSS), code semantics didn't matter too much because the tags "did exactly what they said on the tin". So that:
http://www.websitearchitecture.co.uk/watson/postimages/title.gif
But, now the meaning of these tags (in terms of what they represent/display) can be changed through CSS. So for example, it is possible to render <h1> text smaller than <h2> text. This is all perfectly legal within the context of CSS but the question is: is it correct?
The point is that subverting the original "meaning" of tags with CSS (although not illegal) is semantically incorrect. So Francis is right to feel that the <h1> tag should only be used for a page heading.
The bottom line is that your code must be logical and easily understood by others. Using correct semantics is just part of that.
francis
22nd Dec 2003, 09:23 am
Originally posted by: David
In the days of HTML (before CSS), code semantics didn't matter too much because the tags "did exactly what they said on the tin".
I'm sure I mentioned in our presentations, that CSS (or, at least style sheets) have been around since the first browsers (http://www.w3.org/People/Berners-Lee/FAQ.html#browser). I guess it's just that there wasn't a standard as such back then, so (popular) browser support was non-existent.
David
22nd Dec 2003, 09:55 am
Granted. But the current debate is fuelled by the recent adoption of CSS by the "general" web design community.
Tom
22nd Dec 2003, 10:22 am
See Tim Berners-Lee's article: semantic coding (XML) is ever-so-much more important than CSS for the future of the web.
Scientific American: The Semantic Web (http://www.sciam.com/article.cfm?articleID=00048144-10D2-1C70-84A9809EC588EF21&ref=sciam)
A new form of Web content that is meaningful to computers will unleash a revolution of new possibilities
francis
22nd Dec 2003, 10:54 am
XML is exceptionally important for the future of the Web, but what use will it be to humans without some kind of transformation, be it CSS, XSLT or some client or server-side technology? Surely these transformation technologies must go hand in hand for XML to be of true benefit to us, unless we all fancy reading raw XML tree structures?
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.