untitled

(John Hannent) #1

Of course, this approach to specifying substring matches goes against the
traditional (back to the early days of DOS) punctuation that used *and? as
the primary symbols. Perhaps even worse, the CSS committee’s chosen sub-
stitution symbols aren’t placed inside the string, but instead are attached to
the attribute name (the $attaches to hrefin this example, not within the
string ‘.asp’, where the $would more effectively convey its meaning). But,
in the CSS tradition, don’t expect sensible conformity to traditional punctua-
tion when it’s so much more adventurous to strike out in new directions and
really confuse people.


Mozilla also supports the CSS3 :notcommand. Why they prepended a colon
to the traditional and perfectly useful notcommand is anybody’s guess. This
is a negation pseudo-class selector(more about pseudo-classes shortly). Put
more simply, if something doesn’t pass a test, a certain style is applied. If you
want to put a thick border around any paragraph that currently does not
have a border, for example, here’s how to do it:


<html>
<head>

<style>

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

body {font-size: 24 px;}

</style>

</head>

<body>

<P style=”border: 3px solid blue”>
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>
</html>

This works as advertised in Mozilla Firefox. The first paragraph has a border
style definition, so it’s got a blue border. The second paragraph has no
border assigned in a style, so it’s given a thick red border.


Chapter 15: CSS Moves into the Future 267

Free download pdf