By Christian Heilmann CHAPTER 3
Of course, there are drawbacks. Using more than one of these tab controls
means you need to create unique IDs for all the different targets. Let’s face
it, though — someone who does not understand that an ID is unique will
have trouble coding at all. In the documentation of the widget, you’d ex-
plain that each ID also becomes a part of the URL and thus create readable
URLs as a bonus.
Ideas about HTML should form our main thinking before we go nuts
on extra features and special effects. When everything else breaks, this
is what our users get. Browsers are incredibly forgiving these days; the
HTML5 parser has been built to be backwards compatible. It has to be, be-
cause of the awful markup sins we and our tools committed in the past in
attempts to support terrible browsers that needed hack after hack to render
usable interfaces. This backwards compatibility, however, should not give
us carte blanche to do whatever we want and rely on the browser to fix it for
us. Clean HTML is like good grammar. It is not absolutely essential but it
makes what you do much easier to understand and simpler to translate.
Writing semantic, clean and understandable HTML has fallen out of
fashion. This is sad as it is the lingua franca of the Web and we seem to have
lost a lot of vocabulary when we got all excited about widget libraries and
CMS solutions. Now that browsers have moved on and a lot of the render-
ing problems of “the browser which shall not be named any longer” are
no longer an issue, we should take a look at all the amazing things HTML
gives us and stop using random constructs because they can be easily
styled.
The most common example of HTML abuse is adding links that point
nowhere. A # as the href attribute or, even worse, javascript:void(0),
means you end up writing HTML for a script, and not for the browser to
render or the user to interact with. If you need to call a script, use a button
element. They can be beautifully styled, have in-built keyboard support and
various states, and they can even be disabled using an attribute. By using
attribute selectors in your CSS you can style them. Links are so much more
than initiators of script functionality: they allow users to right-click them