Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > alt and title in <img> tag?

Reply
Thread Tools

alt and title in <img> tag?

 
 
Suzanne Knapp
Guest
Posts: n/a
 
      07-04-2005
Is it ok to use both alt and title attributes in an <img> tag (so all
browsers will honor at least one of them)?


 
Reply With Quote
 
 
 
 
Dylan Parry
Guest
Posts: n/a
 
      07-04-2005
Using a pointed stick and pebbles, Suzanne Knapp scraped:
> Is it ok to use both alt and title attributes in an <img> tag (so all
> browsers will honor at least one of them)?


Yes, it is fine. In fact you *should* be using alt attributes for all
your images. With regards support, I don't know of any browsers that
*don't* support the alt attribute, but I think that Netscape 4 didn't
support title attributes.

Internet Explorer will use the alt attribute as a tooltip, which is
wrong, but will use the title attribute in preference if it is present.

--
Dylan Parry
http://electricfreedom.org -- Where the Music Progressively Rocks
 
Reply With Quote
 
 
 
 
Dan
Guest
Posts: n/a
 
      07-04-2005
Suzanne Knapp wrote:
> Is it ok to use both alt and title attributes in an <img> tag (so all
> browsers will honor at least one of them)?


You should use them in accordance with their standards-compliant
purpose; the ALT attribute is required for all images and should
consist of whatever the image ought to be replaced with if not
displayed (e.g., in a text browser), which may sometimes be a null
string (for spacers and purely decorative images). The TITLE attribute
is not required, but can be used for supplemental information where
this is relevant.

--
Dan

 
Reply With Quote
 
Vladdy
Guest
Posts: n/a
 
      07-04-2005
Dan wrote:
> You should use them in accordance with their standards-compliant
> purpose; the ALT attribute is required for all images and should
> consist of whatever the image ought to be replaced with if not
> displayed (e.g., in a text browser), which may sometimes be a null
> string (for spacers and purely decorative images).

Spacers have reason to be in HTML in this day and age.
Purely decorative images belong in CSS as element backgrounds.

--
Vladdy
http://www.klproductions.com
 
Reply With Quote
 
Suzanne Knapp
Guest
Posts: n/a
 
      07-04-2005
Thanks. I didn't realize that IE's display of Alt text was erroneous - I
thought that was what was supposed to happen, and was surprised when FireFox
didn't do it. At the FF site I learned that they would display Title text,
so thought that using both attributes (with the same text) would give me
what I wanted. So far so good with IE 6 and FF, haven't tried any others
yet.

"Dylan Parry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Using a pointed stick and pebbles, Suzanne Knapp scraped:
>> Is it ok to use both alt and title attributes in an <img> tag (so all
>> browsers will honor at least one of them)?

>
> Yes, it is fine. In fact you *should* be using alt attributes for all your
> images. With regards support, I don't know of any browsers that *don't*
> support the alt attribute, but I think that Netscape 4 didn't support
> title attributes.
>
> Internet Explorer will use the alt attribute as a tooltip, which is wrong,
> but will use the title attribute in preference if it is present.
>
> --
> Dylan Parry
> http://electricfreedom.org -- Where the Music Progressively Rocks



 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      07-04-2005
> From: Dylan Parry <(E-Mail Removed)>
>
> Using a pointed stick and pebbles, Suzanne Knapp scraped:
>> Is it ok to use both alt and title attributes in an <img> tag (so all
>> browsers will honor at least one of them)?

>
> Yes, it is fine. In fact you *should* be using alt attributes for all
> your images. With regards support, I don't know of any browsers that
> *don't* support the alt attribute, but I think that Netscape 4 didn't
> support title attributes.
>
> Internet Explorer will use the alt attribute as a tooltip, which is
> wrong, but will use the title attribute in preference if it is present.
>


I'd say to be careful about titles, they seem to invariably produce pop out
bubbles which are sometimes a distracting nuisance...

(1) Once I was greatly irritated because I was using the mouse to point
things out to someone in a picture, every time the mouse moved the bubble
would pop up. (2) I have had cases of these pop outs obscuring things I
wanted to see. (3) I *wanted* to read the content of the bubbles but they
refused to stay long enough! (Sorry, it sounds like I am hard to please...
but there is a serious point here.)

Surely all browsers "honor" alt tags? So the decision is when to use
"title". I'd say, only if you want the viewer to briefly see some very short
extra info ... in an image not likely to be so great that a viewer might
want to lovingly feel all over it with a mouse...

dorayme

 
Reply With Quote
 
Suzanne Knapp
Guest
Posts: n/a
 
      07-04-2005
The popouts are the effect I was trying for, so Title is fine for that
purpose. They stay on as long as the cursor is over the image, which is
what I want. The only problem is older browsers that don't display title
text, and the Alt text covers those (at least the ones I know about).

Suzanne

"dorayme" <(E-Mail Removed)> wrote in message
news:BEF006CD.14191%(E-Mail Removed)...
>> From: Dylan Parry <(E-Mail Removed)>
>>
>> Using a pointed stick and pebbles, Suzanne Knapp scraped:
>>> Is it ok to use both alt and title attributes in an <img> tag (so all
>>> browsers will honor at least one of them)?

>>
>> Yes, it is fine. In fact you *should* be using alt attributes for all
>> your images. With regards support, I don't know of any browsers that
>> *don't* support the alt attribute, but I think that Netscape 4 didn't
>> support title attributes.
>>
>> Internet Explorer will use the alt attribute as a tooltip, which is
>> wrong, but will use the title attribute in preference if it is present.
>>

>
> I'd say to be careful about titles, they seem to invariably produce pop
> out
> bubbles which are sometimes a distracting nuisance...
>
> (1) Once I was greatly irritated because I was using the mouse to point
> things out to someone in a picture, every time the mouse moved the bubble
> would pop up. (2) I have had cases of these pop outs obscuring things I
> wanted to see. (3) I *wanted* to read the content of the bubbles but they
> refused to stay long enough! (Sorry, it sounds like I am hard to please...
> but there is a serious point here.)
>
> Surely all browsers "honor" alt tags? So the decision is when to use
> "title". I'd say, only if you want the viewer to briefly see some very
> short
> extra info ... in an image not likely to be so great that a viewer might
> want to lovingly feel all over it with a mouse...
>
> dorayme
>



 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      07-05-2005
Previously in alt.html, dorayme <(E-Mail Removed)> said:

> I'd say to be careful about titles, they seem to invariably produce pop out
> bubbles which are sometimes a distracting nuisance...


On IE, alt does the same.

> Surely all browsers "honor" alt tags?


*Attributes*. alt *attributes*.

> So the decision is when to use
> "title".


Use an empty title (title="") to stop IE from displaying the alt
attribute as a tooltip.

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      07-05-2005
Previously in alt.html, Suzanne Knapp <(E-Mail Removed)> said:

> Thanks. I didn't realize that IE's display of Alt text was erroneous - I
> thought that was what was supposed to happen,


A common misconception, thanks to IE's behaviour.

According to the specs -
http://www.w3.org/TR/html4/struct/objects.html#adef-alt - the alt
attribute specifies a textual *alternative* to the image. IOW, it is
supposed to be displayed only if the image *isn't*, for whatever reason.

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      07-05-2005
Previously in alt.html, Vladdy <(E-Mail Removed)> said:

> Spacers have reason to be in HTML in this day and age.


I think that would be *no* reason?

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
different window title and browser tab title soonic HTML 11 07-27-2011 07:59 PM
alt.autos.porsche928,rec.humor.oracle.d,alt.balordi.it,alt.computer,sci.med.laboratory . Computer Information 1 06-18-2004 08:44 AM



Advertisments