Hi all,
It is a newbie's question about html tag "img".
The attributes "title" and "alt" for "img" seems having the same
function. So what is the main difference between them?
Can i use them at the same time and set different values?
Thank you for suggestions! 8 10589
Quoth the raven Lian: Hi all, It is a newbie's question about html tag "img". The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them?
The alt attribute is an 'alternative' to the image, and is what the
browser shows if images are turned off, or the visitor is using a text
browser. One popular operating system component masquerading as a
browser also displays the alt text as a "tooltip" if hovered (and if
there is no title attribute).
The title attribute is generally for additional descriptive text to go
along with the image. This is where you place text you want to display
in the "tooltip".
Can i use them at the same time and set different values?
By all means.
--
-bts
-This space intentionally left blank.
In comp.infosystems. www.authoring.html Lian said: It is a newbie's question about html tag "img". The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them?
alt = text [CS]
For user agents that cannot display images, forms, or applets, this
attribute specifies alternate text. The language of the alternate text
is specified by the lang attribute. http://www.w3.org/TR/html401/struct/....html#adef-alt
title = text [CS]
This attribute offers advisory information about the element for which
it is set.
[...]
Values of the title attribute may be rendered by user agents in a
variety of ways. For instance, visual browsers frequently display the
title as a "tool tip" (a short message that appears when the pointing
device pauses over an object). Audio user agents may speak the title
information in a similar context. For example, setting the attribute on
a link allows user agents (visual and non-visual) to tell users about
the nature of the linked resource: http://www.w3.org/TR/html401/struct/...tml#adef-title
Web Content Accessibility Guidelines 1.0
Checkpoints: 1.1 Provide a text equivalent for every non-text element
(e.g., via "alt", "longdesc", or in element content). This includes:
images, graphical representations of text (including symbols), image map
regions, animations (e.g., animated GIFs), applets and programmatic
objects, ascii art, frames, scripts, images used as list bullets,
spacers, graphical buttons, sounds (played with or without user
interaction), stand-alone audio files, audio tracks of video, and video.
[Priority 1] http://www.w3.org/TR/WCAG10/wai-page...ext-equivalent
Use of ALT texts in IMGs http://ppewww.ph.gla.ac.uk/~flavell/alt/alt-text.html
The "tooltip" effect and the title attribute http://www.cs.tut.fi/~jkorpela/html/alt.html#tooltip
--
v o i c e s o f t h e l i t t l e
On Fri, 29 Oct 2004 11:39:53 +0800, Lian <da**@dfaf.com> wrote: The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them?
In theory, (as others have posted) the difference is that one's an
annotation to an image (title) and the other (alt) is an alternative
for when the image isn't shown.
In practice, the difference depends on browser variations between IE
and FireFox.
IE 4 (4 ?) started to show the alt text as a floating tooltip. It
wasn't _wrong_ to do this, although a better implementation would have
used the new title attribute. The feature was popular and it probably
encouraged use of alt attributes when they'd have been ignored
entirely if it were just for their real purpose.
The recently popular Firefox though takes a different approach. This
is no more "correct", as the HTML spec is generous. Firefox _only_
uses the title attribute to display a tooltip, even when there's an
alt but no title. Obviously the best behaviour for both browsers would
have been to use title correctly in the first place, and (debatably)
to use alt instead if that was the only one available.
So if you carry on authoring according to last year's impression of
"best practice" (using alt religiously and ignoring title) then
you're now going to get a surprise from Firefox -- your tooltips
disappear.
So if you want tooltips for both IE and Firefox, you have to put them
in twice.
Can i use them at the same time and set different values?
Yes. This is good practice, although tedious. Set both though, even
if they're just the same because you don't have time to do the
copywriting to make them different,
There _may_ be a page reader out there that responds clumsily to
simultaneous use. If they're both used together than a user agent
(speech or visual) shouldn't ever render both attributes
simultaneously, just because they were both supplied. I don't know
much about readers, but I'd appreciate feedback if anyone knows of
one?
--
Smert' spamionam
Andy Dingley wrote: IE 4 (4 ?) started to show the alt text as a floating tooltip. It wasn't _wrong_ to do this, although a better implementation would have used the new title attribute. The feature was popular and it probably encouraged use of alt attributes when they'd have been ignored entirely if it were just for their real purpose.
Unfortunately, IE's behavior tended to encourage abuse of the alt
attribute. It probably would have been better if MS had not implemented
alt as tooltip. And if they had implemented title as tooltip, all the
better, since authors would have flocked to title, using it for its
intended purpose instead of abusing alt. After all, alt is an
accessibility issue, while title is merely a means to provide "advisory"
information.
--
Brian (remove "invalid" to email me)
On Sat, 30 Oct 2004, Andy Dingley wrote: On Fri, 29 Oct 2004 11:39:53 +0800, Lian <da**@dfaf.com> wrote:
The attributes "title" and "alt" for "img" seems having the same function.
HTML is markup. The markup is descriptive. It's the browsers which
take that markup and do something with it. That "something" is called
"rendering". This partitioning of the problem space is an important
feature of the design of HTML, in my opinion, and seems to me to be
missing in the above-quoted remark.
In order to find out what the "title" and "alt" attributes were meant
for, it's no use looking at the behaviour of a few browsers - you need
to look at the specifications (of HTML) and guidelines (e.g web
accessibility content authoring guidelines). You're then in a
position to evaluate how well various browsers implement those
guidelines in their various rendering modes. In theory, (as others have posted) the difference is that one's an annotation to an image (title) and the other (alt) is an alternative for when the image isn't shown.
Agreed.
In practice, the difference depends on browser variations
I'd have to disagree. You're supposed to author documents in
accordance with guidelines, not by targetting at specific browser
variations.
between IE and FireFox.
There *are* other browsers...
IE 4 (4 ?) started to show the alt text as a floating tooltip.
Let's not get bogged down in detail, but I don't think that behaviour
was in any way exclusive to InternetExploder.
It wasn't _wrong_ to do this,
I know at least one purist who says it /was/ wrong: browsers have no
business displaying -alternative- text while the image is being
presented. That's what -alternative- means, after all: either the
one, or the other. At least not as their default behaviour
(accessibility guidelines *for client agent design* would suggest
making the alternative text an available *user option* in the browser,
for those who feel they want/need it - and we know one who says that
he does).
although a better implementation would have used the new title attribute.
Indeed.
The feature was popular and it probably encouraged use of alt attributes when they'd have been ignored entirely if it were just for their real purpose.
But a very mixed blessing, since some entirely unsuitable alternative
texts were being chosen as a consequence of misinterpreting the role
of this attribute as being supplementary tool-tip information, instead
of mandatory alternative information.
IMNSHO, the presence of an inappropriate alt attribute is often worse
- sometimes significantly worse - than the offence of having none at
all.
The recently popular Firefox though takes a different approach. This is no more "correct", as the HTML spec is generous.
Hixie has some well-argued reasoning: http://www.hixie.ch/advocacy/alttext
Not everyone agrees with his conclusions, but I think it's entirely
fair to say that at least he's presented the reasoning in an open and
logical fashion. In fact I find myself in agreement with most of what
he says, and any disagreements I have are fairly specialised.
Firefox _only_ uses the title attribute to display a tooltip, even when there's an alt but no title.
This is the right thing to do, IMHO.
Obviously the best behaviour for both browsers would have been to use title correctly in the first place,
Theoretically, yes. Except that, for a long time, authors were
hampered by the wide usage of Netscape 4, which failed to render the
title attribute. However, I think it's fair to say that even authors
who care that their content is still browseable on Netscape4, no
longer consider that browser to be worth further consideration on
subtle details of presentation.
and (debatably) to use alt instead if that was the only one available.
On this point I think Hixie's conclusion is better. One shouldn't
tempt authors to choose inappropriate -alternative- texts by
presenting them as -tooltips-.
So if you carry on authoring according to last year's impression of "best practice" (using alt religiously and ignoring title) then you're now going to get a surprise from Firefox -- your tooltips disappear.
Rightly so...
So if you want tooltips for both IE and Firefox, you have to put them in twice.
Eh? Given that we seem to agree that title= is the theoretically
correct place for tooltips, you only have to put them in once, for
quite a range of browsers. This is -not- an alternative to providing
"appropriate"[1] alternative text, in its proper place: that provision
is made mandatory by the guidelines, but only the context can be
decisive as to whether the chosen -alternative- text was apt.
Can i use them at the same time and set different values?
Yes. This is good practice,
Absolutely.
although tedious.
As "Callie" said to me, many years back now:
Many authors haven't figured out exactly what they are trying to
present; they don't know what it is about the image that's important
to the page's intended audience. The reason you can't figure out why
their alt [texts] aren't working is that they don't know why the
images are there.
Choosing the (mandatory) alternative text -should- be no big deal, in
the majority of cases, for an author who knows what the page is trying
to communicate to the reader: it just needs to become a habit. It's
got almost nothing to do with - in the majority of cases - appropriate
selection of optional "short supplementary text" (to precis the
guidelines), intended to be presented as an optional tooltip etc.
Set both though, even if they're just the same because you don't have time to do the copywriting to make them different,
I wouldn't choose that as an authoring guideline, frankly.
Occasionally, it might just turn out to be the right answer, but I'd
rather reason my way there, in a particular instance, based on some
well-founded authoring guidelines.
all the best
[1] where "appropriate" sometimes means alt="" or alt=" "
On Sat, 30 Oct 2004 16:15:13 +0100, Andy Dingley
<di*****@codesmiths.com> declared in
comp.infosystems. www.authoring.html: In practice, the difference depends on browser variations between IE and FireFox.
AFAIK IE is the only ("common") browser that exhibits the behaviour you
mention.
IE 4 (4 ?) started to show the alt text as a floating tooltip. It wasn't _wrong_ to do this,
I disagree. The fact that alt text is supposed to be an "alternative"
implies that the 2 are mutually exclusive. So a UA shouldn't ever render
both at the same time.
although a better implementation would have used the new title attribute.
Agreed.
The recently popular Firefox though takes a different approach. This is no more "correct", as the HTML spec is generous.
Again, I disagree. We had a discussion about this recently in (IIRC)
alt.html too, so I don't really feel like going into a lot of detail
here.
Firefox _only_ uses the title attribute to display a tooltip, even when there's an alt but no title.
As do most other browsers.
So if you want tooltips for both IE and Firefox, you have to put them in twice.
Not so. If both alt and title are present, IE will display the title
text as the tooltip, not alt. So title is the only one necessary for
tooltips.
Yes. This is good practice, although tedious. Set both though, even if they're just the same because you don't have time to do the copywriting to make them different,
Like Alan, I disagree with this too. The alt text is supposed to be an
alternative to the image, the title is supposed to give additional
(non-crucial) information. On some occasions the two _may_ need to be
the same, but this would be very rare.
--
Mark Parnell http://www.clarkecomputers.com.au
Mark Parnell <we*******@clarkecomputers.com.au> wrote in message news:<d2*****************************@40tude.net>. .. AFAIK IE is the only ("common") browser that exhibits the behaviour you mention.
I believe Netscape 4.x did as well, but it's not really "common" any more.
--
Dan
Mark Parnell wrote: The alt text is supposed to be an alternative to the image, the title is supposed to give additional (non-crucial) information. On some occasions the two _may_ need to be the same, but this would be very rare.
Perhaps not so rare. An online art gallery might use identical alt and
title attributes for images.
--
Brian (remove "invalid" to email me) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mike |
last post by:
regards:
I use Jtidy (api) to translate a HTML file into a "XHTML file".
But The "XHTML file" cannot be identified by nokia 6600.
Do I miss something important?
Or this is Jtidy's weakness or...
|
by: Allen |
last post by:
I am trying to add an additional photo/hyperlink to the company web
site (I didn't create it) without any luck. The mouseover feature
'highlights' pics by swapping them with another pic using this...
|
by: Hostile17 |
last post by:
Consider the following HTML.
----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta...
|
by: davidkarlsson74 |
last post by:
Error: document.getElementById("folderMenu").cells has no properties
File: http://www.volkswagen.se/tillbehor/js/foldermenu.js
Rad: 49
The function activates different DIV:s, but doesn't seem to...
|
by: garfy |
last post by:
Hi
i get this error in validation
Line 22 column 6: document type does not allow element "title" here.
<title>Seo Web Design Los Angeles - Web Design And Search Engine Optimization L
...
|
by: eholz1 |
last post by:
Hello PHP programmers.
I had a brilliant idea on one of my pages that selects some data from
my mysql database.
I first set the page up to display some info and an image, just one
item, with a...
|
by: Eric Layman |
last post by:
Hi everyone.
An image allows alt attribute. When mouse over images with alt attribute, a
small yellow popup would appear besides the mouse cursor.
How to replicate this behaviour using a table...
|
by: rkhurana |
last post by:
Hi
I am writing a JSF application that uses some third party charts. While I can see the chart but the javascript that is supposed to calla function to update chart periodically has a problem. It...
|
by: jasone |
last post by:
hi everyone!
any advice given will be MUCH appreciated, i have spent about 10 hours on this bit of script... a rating system. I am having realt trouble overcoming this problem at runtime
...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |