untitled

(John Hannent) #1
Like it or not, designers and programmers must wrestle with the reality that
CSS is less clear and efficient than it could have been. What you’re faced with
when writing CSS is the need to always stay on your toes. And — given the gen-
eral lack of effective HTML and CSS code debugging messages — when your
Web page doesn’t work as expected after you load it into Internet Explorer, you
should first check the punctuation. Punctuation gone awry is the source of
most errors in CSS. Ensure that your open and close braces are in place, that
you have semicolons and colons in the right places, and that you’ve not left off
something else such as a close tag (such as using <script>but forgetting to
insert the closing </script>, for instance).

Also, some experts suggest that you always write your styles the same way,
so you get into the habit of including everything. One approach is to start
each rule by first typing in the opening and closing braces {}. Then type each
property and its ending semicolon. Finally, fill in the value for each property.
This approach works for some people, cutting down on some errors. But
common sources of errors, such as last-minute tweaking, aren’t prevented by
this technique.

Validating Your Work ..................................................................................


Ensuring that your CSS or HTML code has no problems is called validating.
This process can assist you in locating actual bugs and can also provide
other useful information. For example, validation can warn you that you’re
using “nonstandard” HTML tags or other features that work in Internet Explorer
but might not always be supported in future versions or that may not work in
other browsers such as Netscape.

300 Part IV: Advanced CSS Techniques


Of rebates and punctuation insanity


Yes, the punctuation madness is baffling, but I
sometimes wonder if it isn’t meant to be that
way, like one of life’s other little inefficiencies,
rebates. Somebody is making a buck off the
confusion. You buy because the price is low but
then forget to send in the rebate card. Experts
say that more than $500 million in rebates are
unclaimed every year.

You can see why companies deliberately intro-
duce all kinds of hassles into the rebate
process: due dates in fine print (rebate ended
last year), you left out one of the required items,
you bought two and the rebate only works for

one (fine print again), you accidentally damaged
the bar code, and so on.

I suspect that at least some of the annoying and
inefficient aspects of computer programming
languages fall into this same category: deliber-
ate confusion is designed into the “code” dic-
tion, punctuation, and syntax to preserve the
jobs of people who program or teach program-
ming. After all, if programming were straight-
forward, they couldn’t sell their services.
Everybody could tell computers how to behave,
not just the elite.
Free download pdf