[whatwg] The IMG element, proposing a CAPTION attribute

Steve Runyon s.runyon at gmail.com
Wed Nov 15 07:07:31 PST 2006


I'll throw in my 2 cents with you, Alexey - a generic facility like this is
needed.  <label> seems like the perfect pre-existing solution, and if it has
problems outside forms as you stated earlier, that's just something that
browsers makers will have to address if it gets into the standard...or am I
being naive? ;-)

By doing something generic like this, labels could be used for content
that's visible and/or audible, logically in-stream and/or out-of-stream
(depending on the client) as determined by CSS, and could be defined
separately from the content they're describing (because of the 'for'
attribute).  While that could lead to some confusion - particularly in cases
of misuse or overuse - it's also a powerful tool to present
nicely-formatted, mixed in-stream and out-of-stream content simply by
switching stylesheets.

Thinking out loud on CSS selectors for the various tags that have been
proposed:
   <label>: attribute selector (ex: label[for="myImg"]{...})
   <caption>: adjacency selector (ex: #myImg+caption{...})
   <legend>: adjacency or parent-child selector (ex: #myImg+legend{...} or
#myImg>legend{...})

I see no clear advantage - any of the above could be preferable/less
preferable depending on the circumstances and organization of the individual
page.


On 11/13/06, Alexey Feldgendler <alexey at feldgendler.ru> wrote:
>
> On Mon, 13 Nov 2006 22:30:13 +0600, Jeff Seager <Jeff.Seager at wvdrs.org>
> wrote:
>
> > After reflecting on your points and others, Alexey, I do expect more of
> > a caption than I expect of a simple attribute. Most importantly, I
> > expect it to be visible by default if I have a visible picture. For that
> > reason, I agree now with those who suggest a CAPTION (or LEGEND)
> > element, rather than an attribute.
>
> I totally agree with you here.
>
> I believe HTML should have an element for every attribute intended to hold
> human-readable text. A raw idea can go like this:
>
> <img id="img1" src="...">
> <label for="img1" type="title">...</label>
>
> Here, <label> holds a value which should be treated the same way like the
> title attribute on <img>, except that it can contain nested markup. This
> would be useful for all attributes defined as %Text in HTML -- in HTML4,
> these are ABBR, ALT, LABEL, STANDBY, SUMMARY, TITLE. However, doing a full
> straightforward solution like this may be bad for backward compatibility,
> especially in the case of ALT. But the idea is: whenever we write an
> attribute of type %Text, we want text with markup, so an element instead of
> attribute is needed.
>
>
> --
> Alexey Feldgendler <alexey at feldgendler.ru>
> [ICQ: 115226275] http://feldgendler.livejournal.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20061115/8012ce61/attachment-0001.htm>


More information about the whatwg mailing list