Hi all
I would like to propose a new property for CSS3. The general idea
is to associate with a selector content which has to be displayed when
it is "designated" by the user (pointed, selected, etc.), temporarily
and apart from the document tree, in order to give important relative
information. I describe it first, then I give some details about it. If
something like this has already been proposed, please tell me.
1. Description
--------------
Let's take an example. In HTML 4.0, you can associate with an
abbreviation its meaning.
<abbr title="World Wide Web Consortium">W3C</abbr>
HTML doesn't define the default behavior of a UA towards the 'title'
attribute.
Presently, you can take it into account with a rule such as :
abbr[title]:after { content: " (" attr(title) ")" }
A new possibility would be :
abbr[title] { floating-content: attr(title) }
The 'floating-content' property (the name I've given may be completely
ridiculous...) would accept all values of the 'content' property (but
maybe a URI), at least a string and the 'attr()' value.
The property is vague in order to be media-independent. The exact
rendering wouldn't be defined. For a dynamic, visual agent, like IE or
Navigator, a classical rendering would be to display a yellow-background
text when the abbreviation is flown over. In any case, a conformant UA
*wouldn't have to* recognize such a property.
Let's take another example :
:lang(en) > a[href][hreflang|="fr"] {
floating-content: "Warning\A0! This document is in French\A0!"
}
A text-only browser, like Lynx, could display the message in the status
bar when the link is selected. A braille or aural device could announce it
to the user for confirmation. Note a dynamic visual agent could have a
double behavior :
(:hover) yellow-background text box
(:focus) text in the status bar
[The rule is the UA must provide "floating content" where the user is
expecting to find relative information]
2. Some details about
---------------------
* The property shouldn't be specified with a dynamic pseudo-element
(hover, focus, active) to respect media-independence. But if it is, the UA
should respect it, since it would be possible to define several "floating
contents".
<a class="forbidden" href="...">Don't click here</a>
a[href].forbidden:hover {
floating-content: "Don't hang around about here\A0!"
}
a[href].forbidden:active {
floating-content: "Don't you understand plain English\A0??"
}
The property would be ignored if the UA doesn't know the specified
pseudo-element.
* The 'alt' attribute of an <img> element is *not* "floating content"
(according to the HTML spec).
Let's take the example of the X-Company which replaces its name by its
logo (I hope this word exists...) in its web site. A correct code would
be :
<img src="..." alt="The X-Company" title="The X-Company logo
100x50 \A9 copyright 1999 any duplication prohibited">
The X-Company will want to render the image like this :
img[title] { floating-content: attr(title) }
where a classical visual agent would simply have rendered
img { floating-content: attr(alt) }
(which is a semantically wrong rule).
[To render the 'alt' attribute, CSS would have first to give a solution
for formatting an image. For instance
img([src]):before { content: attr(alt); content: url(...) }
or
img([src]) { content: url(...), attr(alt) }
(in defining the 'content' property for empty elements).]
* A UA can display a "floating content" for a limited time if it chooses
it.
* The property would be inherited, and so could be canceled by a
{ floating-content: "" }.
* A last thing : the traditional browser effect which is to display the
address associate with a link in the status bar *shoudn't* be considered
as "floating content" because :
- this is not directly an attribute value ; if the link uses a relative
address, the displayed address must be absolute. A UA is needed to parse
the address (note this may be changed with CSS).
- some browsers, like Lynx, display the address depending on the user
setting (beginner or advanced). This proves the function depends on the UAs
and not on stylesheets (this is a personal advice).
- some other browsers (IE, Navigator) display the address in the status
bar *and not* directly on the page (!= 'alt' attribute), this because the
information isn't relative to the document content and could trouble some
users (cf. the preceding argument).
- the address can be provided relative to a contextual menu allowing to
add bookmarks for instance, which is a UA capability, not style (!). For a
link, a UA could (should) provide both a "floating-content" and the
address of the link.
Nico
--
Nicolas Lesbats - nlesbats@etu.utc.fr
85 r. Carnot 60200 Compiegne - France
+33/0 686 800 908
Plaider <http://wwwassos.utc.fr/~plaider/>
3:-) Moooooooooooooooooooooooo !