Afficher un message
Vieux 16/03/2008, 16h36   #3
Jukka K. Korpela
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I set a different style for <a title="" /> or <img title="" />?

Scripsit Lorenzo De Tomasi:

> In <a href="http://index.html" title="Go to the homepage">Homepage</a>
> or in
> <img src="paris.jpg" alt="Two children running in front of the Eiffel
> tower" title="Paris, 2008">,
> using only css, I would like to set a different text-color or
> background-color for the 'title box' that appears when i do a rollover
> on the link or the image (Firefox default is a black text on a yellow
> background box).
>
> Is it possible?


No, it isn't, since the "tooltip text" does not even exist in CSS terms.
You can refer to the text as text in CSS rules in certain ways but you
cannot describe its rendering in CSS, since there need not be any
default rendering for it and if there is, it cannot be referred to in
CSS.

Before starting to consider some special techniques that may create a
"mouseovet effect" in addition to and independently of browsers'
eventual "tooltip texts", consider whether it would be useful and
whether it would be worth the effort. Note that the costs include
potential user confusion. Anything that _looks_ like a popup window is
suspicious to many people, and things that pop up and out may confuse a
screen reader or a user's mind.

For example, "Go to the homepage" is just a nuisance and doesn't resolve
the issue what the link really points to. Instead of "Homepage", use a
descriptive link text like the company's name (followed by " main page",
if pointy-haired bosses insist on your being pointlessly verbose). Thus,
the need for any "mouseover effect" vanishes in a puff of logic.

Similarly, title="Paris, 2008" is pointless. If the information matters,
put it below the image as normal text, though perhaps styled to be
different from copy text, centered, etc., to look like a caption or
description (see http://www.cs.tut.fi/~jkorpela/www/captions.html ). And
if it does not matter, leave it out. The alt="..." attribute in <img> is
even more pointless. Who is it for? Traditionally, alt attributes have
been described as ing blind people who do not see images. Would you
like to listen to (or read with your fingertips) babbling like "Two
children running in front of the Eiffel tower"?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

  Réponse avec citation
 
Page generated in 0,07207 seconds with 9 queries