[uf-discuss] RFC: Using <img>'s alt attribute for Microformats

Ryan King ryan at technorati.com
Wed Dec 14 15:24:06 PST 2005


On Dec 14, 2005, at 3:04 PM, Scott Reynen wrote:
> On Dec 14, 2005, at 4:15 PM, Ryan King wrote:
>> On Dec 14, 2005, at 12:47 PM, Charles Iliya Krempeaux wrote:
>>> So, maybe hCard's, hReview's, etc should allow this too?  For  
>>> example:
>>>
>>>     <address class="vcard">
>>>         <img class="fn" src="my-name-in-styled-lettering.png"
>>> alt="Charles Iliya Krempeaux" />
>>>     </address>
>>>
>>> (And, yeah, I know this would give the problem that would can't add
>>> the sub-structure to the "fn" that hCard's allow.  But you could
>>> always break it up into multiple images if you wanted.  And at least
>>> then you'd support this very common practice.)
>>
>> For properties that don't expect images it might be reasonable to  
>> use the alt attribute value for the value of the property.  
>> However, it might be a bit too open ended (and how often do people  
>> do this, anyway?).
>
> Using images of stylized text with alt attributes containing the  
> text is quite common:
>
> http://www.google.com/
> http://www.apple.com/
> http://www.yahoo.com/
> http://www.microsoft.com/
> and, um...
> http://www.technorati.com/
> http://microformats.org/

Eh, good point. I guess I wasn't thinking about logos and such. But  
in the case of technorati.com, we could reasonably make our logo into  
an hcard with:

<span class="vcard">
	<a class="url" href="http://technorati.com/">
		<img class="org fn logo" src="http://static.technorati.com/pix/tn- 
logo.gif" alt="Technorati" />
	</a>
</span>

With the interpretation being:

fn=Technorati
org=Technorati
url=http://technorati.com/
logo=http://static.technorati.com/pix/tn-logo.gif

> If you're asking about TV show titles specifically, I'm sure  
> Charles could answer that better, but here's one:
>
> http://tv.yahoo.com/
>
> My question: which should take precedence between alt and title  
> values?

Good question.

 From the spec [http://www.w3.org/TR/REC-html40/struct/ 
objects.html#adef-alt]:

> 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.
> 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.
and [http://www.w3.org/TR/REC-html40/struct/global.html#h-7.4.3]

> title = text [CS]
> This attribute offers advisory information about the element for  
> which it is set.

It seems to me that title would not make sense for content (except  
for in the case of the abbr-datetime pattern). Alt seems more  
meaningful here.

-ryan

--
Ryan King
ryan at technorati.com





More information about the microformats-discuss mailing list