Click to See Complete Forum and Search --> : Image alt="name" box help
jlsheets
01-21-2003, 11:31 PM
This is going to be an odd request but I know there is a way to change the color of the alt box and text color in the alt box of an image.
You know how when you have an image and if it's named via the alt="name" when you put your mouse on it there is a box. How do I change the background color and text font and color of that box?
Is it Javascript DHTML? If anyone knows the coding for it I'd greatly appreciate it.
jpmoriarty
01-22-2003, 05:16 AM
i think the default colours and so on can only be changed with access to the system. However, i do know that there is javascript and DHTML you can use to do your own, should you wish. THe example i've found is from a mate of mine's site - if you hover over the links on the left hand side (some of them anyway) then there are boxes that pop up, and also have html commands (like<b>) inside them. Fairly nifty.
If you're competent then you should be able to hack away at his code to see what he's done and replicate it on your site. that's what i tried to do (before i got bored and decided against it!)
The site is henry bevan's site (http://www.henrybevan.co.uk) - if there are simpler ways of doing it then i'd sure be interested, but this is the only one i've seen.
Charles
01-22-2003, 05:50 AM
By the way, that little box that shows up in MSIE displaying the value of the ALT attribute is a non-standard and incorrect feature. The little box is called a "tool tip" and it's supposed to be associated with the TITLE attribute. Of the ALT attribute, however, it is written:From http://www.w3.org/TR/html4/struct/objects.html#adef-alt
Several non-textual elements (IMG, AREA, APPLET, and INPUT) let authors specify alternate text to serve as content when the element cannot be rendered normally. Specifying alternate text assists users without graphic display terminals, users whose browsers don't support forms, visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc.
The alt attribute must be specified for the IMG and AREA elements. It is optional for the INPUT and APPLET elements.In other words the value of the ALT attribute only gets displayed when the image is not displayed.
jpmoriarty
01-22-2003, 06:20 AM
i dont want to sound argumentative, but one of the things that annoys me about the rule-abiding people who post to this board, is their inability to even accept things that are incorrect.
For example, In other words the value of the ALT attribute only gets displayed when the image is not displayed. . This is incorrect. in internet explorer, if you put something in the alt tags and hover your mouse over the image, the alt text is displayed.
Now, I can accept that this might be against W3C (and possible other people) regulations. I expect that all browsers might not do this. And yes, it probably is incorrect. That still doesnt change the fact, however, that if you are using IE and you hover over an image, if there is text in the ALT tags it will be displayed.
I think people's willingness to attempt to conform to the various rules and regulations that are out there will be greatly decreased by people blatantly trying to either ignore or deny that these features exist! By all means advise that they're not standard, and that it's bad programming practice to make use of them: but to come out and say that ALT tags only display when the image isnt, is incorrect.
Charles
01-22-2003, 06:33 AM
The ALT attribute is an accessibility feature. People with visual disabilities rely upon its proper use when the use the web. To intentionally mis-use it when authoring a web page is cruel and unforgivable.
jpmoriarty
01-22-2003, 06:50 AM
humm, we're getting there.
As long as he uses the ALT to specify alternative text for those without graphic display terminals, users whose browsers don't support forms, visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc. then he is not misusing the ALT tag. If he wants to make it a differnet colour when it displays in IE, then he can do that fine (if indeed he can, as was the original question), providing that doing so doesnt interfere with the group listed above.
You're assuming that just because he wants to change the background colour of the tooltip, he is intentionally mis-using
the alt tag, which is a non-sequitur.
Robert Wellock
01-22-2003, 07:07 AM
If you put another slant on the issue; some browsers like Micro$oft incorrectly display the "alternative text" as defined via the alt attribute in a similar fashion to a tool tip, when images are enabled.
Which goes against the proposed Technical Recommendations, and Web Accessibility Guidelines, some of which Micro$oft helped develop and hence defeating the primary purpose of that attribute.
Hence colouring the attribute could be considered either a browser specific solution, or an example of proprietary code manipulation, which is best avoided, or could be consider bad coding practice, since it is not very interoperable in nature
:D.
Stefan
01-22-2003, 07:56 AM
Originally posted by jlsheets
This is going to be an odd request but I know there is a way to change the color of the alt box and text color in the alt box of an image.
Just as have been stated before ALT is NOT for tooltips (even if some browsers incorrectly show them instead of title if title is missing). Don't abuse ALT for tooltips.
Now once ee have got past that, Ill answer your original question, how to get TOOLTIPS with custom colors and backgrounds.
It's easiest done with CSS. Eg this is a way to do it
<style type="text/css">
a span {display:none; color:green; background:#ccc;}
a:hover span {display:block; position:absolute; width:200px;}
</style>
</head>
<body>
<p>
<a href="link to fullsize image"><img scr="thumbnail.png" alt="description of image" title=""><span>the text in here will be displayed as a tooltip when you hover the link/image</span></a>
</p>
Note: the title="" is needed due to IE's irritating habit of incorrectly showing ALT as TITLE, if no TITLE is specified.
jpmoriarty
01-22-2003, 08:15 AM
stefan,
that's doing nothing for me - does it work in the ever buggy ie?
Vladdy
01-22-2003, 11:18 AM
For custom formating of tooltips you need javascript implementation. Here is mine: www.vladdy.net/webdesign/tooltips.html
Stefan
01-23-2003, 10:34 AM
Originally posted by jpmoriarty
stefan,
that's doing nothing for me - does it work in the ever buggy ie?
Didn't test that code, but in general CSS popups works in IE 5.5x+
Stefan
01-23-2003, 10:37 AM
Originally posted by Vladdy
For custom formating of tooltips you need javascript implementation.
Um no...
http://hem.bredband.net/stehus/logd/downloads.html
No JS for popups on that page.
BTW, where on earth did you pick up that nonexsistant attribute "tooltip"?
Vladdy
01-23-2003, 11:54 AM
Originally posted by Stefan
[B]Um no...[B]
If you want them to appear at the location of cursor as the default ones do - yes.
Stefan
01-23-2003, 03:53 PM
Originally posted by Vladdy
If you want them to appear at the location of cursor as the default ones do - yes.
When did that become a requirement?
And that still doesn't make it ok to make up an attribute out of the blue and add it to your pages.
Vladdy
01-23-2003, 04:40 PM
XHTML = Extensible HyperText Markup Language. So, how is not not ok to add my own attribute, huh? As far as tooltips appearing next to a cursor it is not a requirement, but a rather convinient feature.
Stefan
01-23-2003, 07:24 PM
Originally posted by Vladdy
[B]XHTML = Extensible HyperText Markup Language. So, how is not not ok to add my own attribute, huh?
Yes, you are ALLOWED to add your own attributes INCLUDING the nessecary DTD for it.
But you are NOT doing that. You are using a stock
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
There is NO tooltip attribute in XHTML 1.1
Further, you are also sending your XHTML page as mimetype text/html.
That means that you are dropping the Extensible and are making a document that should follow the quidelines for XHTML "masquerading" as HTML (and that means no made up elements and attributes).
Vladdy
01-24-2003, 05:40 AM
Originally posted by Stefan
Yes, you are ALLOWED to add your own attributes INCLUDING the nessecary DTD for it.
But you are NOT doing that. You are using a stock
I'm all for following the standards, but there are some things that are just not worth worrying about. It does work and that what counts.
Stefan
01-24-2003, 11:33 AM
Originally posted by Vladdy
It does work and that what counts.
You are relying on browser errorcorrection, which is a very poor way to code a webpage. That is definitly not "following standards".
Also, the only reason the page works at all is becuse it's looking at it as if it was HTML, not the fancy XHTML you think you are using.
Just try changing that .html to .xhtml and open your page locally in a gecko browser, and you will see just how broken your page REALLY is.
People that doesn't know nor care about what they are doing should probably stick to HTML 4.01 Transitional.
Vladdy
01-24-2003, 11:44 AM
What I'm using is the fact (call it error correction if you like) that browsers add every atribute they encounter to the element attributes array.
If I try to follow the standard to a letter MS IE will choke. The way it is, the code works in both Gecko and IE5+ and it does so because I do know what I'm doing.
When MS gets their act together I can add DTD and serve it as xhtml.
jlsheets
01-26-2003, 11:10 PM
Um ok.... let me just say this; HUH?!
Ok so I need to put title="text" not use alt, ok. But now will it pop up that little box when you put your mouse over the graphic?
I appreciate being told I was coding that wrong.
Everything else y'all went on to confused the **** out of me.
Im a basic html'er, just barely barely learning any other kind of coding.
I do know how to use html and make sure its correct for XML, but Im sure I have some errors in that as well... either way I dont use XML i cant write XML, so I need just a really basic way to change the color of the box and only if it still pops up when I use title instead of alt.
Stefan
01-27-2003, 02:12 AM
Originally posted by jlsheets
Ok so I need to put title="text" not use alt, ok. But now will it pop up that little box when you put your mouse over the graphic?
Yes.
But to style it with custom colors you will need to do more. (Also you will be overriding the users preference, since the popup colors normally should take on the default popup look of the users Operative System Theme)
If you still want to do it, the best way is probably to do it with CSS, as I showed earlier in the thread.
A tutorial page for it can be found here
http://www.meyerweb.com/eric/css/edge/popups/demo.html