By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,244 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,244 IT Pros & Developers. It's quick & easy.

LABEL Element in a 2-dimensional table

P: n/a
How do you use a LABEL tag within a two dimensional table? In the
examples I've seen for this element, only extremely simple situations
are shown, e.g., <LABEL FOR="wgt">Weight:</LABEL><INPUT TYPE="TEXT"
ID="wgt">
But what if you have ...
<TABLE>
<TR>
<TH>WEIGHT</TH>
<TH>HEIGHT</TH>
</TR>
<TR>
<TD>Girls</TD>
<TD>INPUT TYPE="TEXT" ID="girlwgt"</TD>
<TD>INPUT TYPE="TEXT" ID="girlhgt"</TD>
<TR>
<TD>Boys</TD>
<TD>INPUT TYPE="TEXT" ID="boywgt"</TD>
<TD>INPUT TYPE="TEXT" ID="boyhgt"</TD>
<TR>
</TABLE>
The label "WEIGHT" in the header refers to both id=girlwgt and
id=boywgt; similarly, the label "Girls" refers to both id=girlwgt and
id=girlhgt.
Do you perhaps use two LABEL elements for each label? Or do you have
only one LABEL element, but with multiple id subelements???
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Will Handley wrote:
How do you use a LABEL tag within a two dimensional table?
Is there another kind? I don't think 3d tables, the kind that an
Excel workbook can create, are possible using HTML.
In the examples I've seen for this element, only extremely simple
situations are shown, e.g., <LABEL FOR="wgt">Weight:</LABEL><INPUT
TYPE="TEXT" ID="wgt"> But what if you have ... <TABLE>
<TR>
<TH>WEIGHT</TH>
<TH>HEIGHT</TH>
</TR>
<TR>
<TD>Girls</TD>
<TD>INPUT TYPE="TEXT" ID="girlwgt"</TD>
<TD>INPUT TYPE="TEXT" ID="girlhgt"</TD>
<TR>
<TD>Boys</TD>
<TD>INPUT TYPE="TEXT" ID="boywgt"</TD>
<TD>INPUT TYPE="TEXT" ID="boyhgt"</TD>
<TR>
</TABLE>
Your table is invalid: the rows do not have the same number of
columns. That said, the label element cannot point to two form fields.

http://www.w3.org/TR/html401/interac...tml#edef-LABEL
"The LABEL element may be used to attach information to controls. Each
LABEL element is associated with exactly one form control."
The label "WEIGHT" in the header refers to both id=girlwgt and
id=boywgt; similarly, the label "Girls" refers to both id=girlwgt and
id=girlhgt.


The table markup, without a label element, creates a relationship
between the cells of a row. If you wanted, you could add some markup
to the table, e.g., th elements with scope attribute.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.