untitled

(John Hannent) #1
If you’re not used to CSS or other computer programming languages (aside
from Basic), you may ask: Why did they design this syntax to sound like a
two-year-old: Paragraph not borderis the clumsy syntax of this CSS code.
Couldn’t they have used ordinary English syntax like No border on paragraph
and achieved the same result? Sure they could have. It would have been
easier to remember, easier to read, and easier to fix mistakes. But committees
of academics and professional programmers have agendas other than clarity.
So most programming languages sound fairly Martian with their twisted syn-
tactic flow.

Note that for reasons nobody can explain to me, if you apply a style using a
class, the :notcommand doesn’t work. In the following example, both para-
graphs are bordered in red in Firefox:

<style>

p.bordr {border: 3px solid blue;}

p:not([border]){border: 6px solid red;}

body {font-size: 24 px;}

</style>

</head>

<body>

<P class=”bordr”>
Here’s a paragraph with a border defined in a style. </p>

<P>
Here’s a normal paragraph with no border defined, so it gets
a red border. </p>

</body>

If you remove the square braces, :notworks in this example, like this:

p:not(border){border: 6px solid red;}

Setting opacity ...................................................................................


Another new feature that Mozilla has already implemented from CSS3 is opac-
ity, the ability to add transparency to an element. Here’s how it works in the
CSS implementation that Mozilla recognizes and correctly interprets:

268 Part IV: Advanced CSS Techniques

Free download pdf