Forum Moderators: open

Message Too Old, No Replies

Div, summary and xhtml 1.1

How to add a description to a DIV tag in xhtml?

         

Gusgsm

1:33 pm on Jul 25, 2003 (gmt 0)

10+ Year Member



Good afternoon, folks

I've been reading the thread on accesibility (and related links). I am using the accesibility valet (quite nice) to 'force' a set of pages to become AAA compliant (more a learning challenge than real need).

I designed as tables a set of pictures with captions. Afterwards, I added summaries as needed, but then I realized I should change that into nested DIVs (I've done it partialy).

But, the trouble is: How can I change the accesibility 'added value' of summary="this is blah, blah..." into div-like summaries? It seems that summary attribute is not admited inside div tags (at least in xhtml 1.1, that's what I'm typing for).

Thanks a lot :)

hakre

8:17 am on Jul 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi Gusgsm,

you're right, there is no summary attribute for div in xhtml 1.1.

so you need to place a summary for this in front of the div in another div. metainformation itself can only be placed into the head, so maybe it's good to put this part of your page into another document.

- hakre

MonkeeSage

10:02 am on Jul 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Gusgsm:

While not a particularly 'clean' way of doing things, you could always script the summaries as arbitrary attributes of the div elements, and you will still validate for xhtml scrict that way.

E.g.,

Script:

function getObj(id) {
return document.getElementById(id);
}

function writeSummary(obj, sum) {
obj.setAttribute("summary", sum);
}

Or (for browsers that don't support setAttribute):

function writeSummary(obj, sum) {
obj.summary = sum;
}

HTML:

...

<div id="div1" class="some-class">
</div>

<div id="div2" class="some-class">
</div>

<div id="div3" class="some-class">
</div>

...

<script type="text/javascript">
<!--
writeSummary(getObj("div1"), "this is div1");
writeSummary(getObj("div2"), "this is div2");
writeSummary(getObj("div3"), "this is div3");
//-->
</script>
</body>

It's pretty kludgy, and I'm not sure if it would accomplish what you are trying to accomplish (I haven't had a chance to look at the accessibility section yet), but mabye it will be useful.

Shelumi`El
Jordan

S.D.G

Gusgsm

9:21 am on Jul 28, 2003 (gmt 0)

10+ Year Member



Hakre and Shelumi`El,

Thanks for the try. I think I'll have to resort to the good old 'alt' thing... [snif, snif]

Hester

3:30 pm on Jul 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Title might be a good idea.

insin

4:00 pm on Jul 28, 2003 (gmt 0)

10+ Year Member



I'd suggest going with the title attribute as well - this will also create some mouseover text in visual browsers.

Is summary not meant to provide the description for a set of tabular data (eg. 2003 Accounts) anyway? If so, would it not be slightly semantically redundant when applied to a table being used for layout?