Konrad Viltersten
Konrad Viltersten

Reputation: 39108

TD can't be nested inside TABLE

I just noticed that I get the following warning/error from VS.

Validation (XHTML 1.0 Transitional): Element 'td' cannot be nested within element 'table'

I dare to claim that the element TD can too be nested inside TABLE. In fact, I say that it's the only correct way to use TD. What am I missing?

I've double and triple checked - no TD is nested inside any other TD. They're just inside TR which is inside TABLE.

EDIT

<table>
  <td></td>
  @foreach (String t in ts)
  { <td>@t</td> }
  @foreach (String s in ss)
  {
    <tr>
      <td>...</td>
      @foreach (String t in ts)
      { <td>...</td> }
    </tr>
  }
</table>

Upvotes: 4

Views: 10124

Answers (2)

Darko
Darko

Reputation: 38860

The error suggests you are trying to do this:

<table>
    <td>...</td>
...

but tds must be nested in trs like this:

<table>
    <tr>
        <td>...</td>
    </tr>
...

If you are already doing this, then you will need to show the HTML. Without seeing the HTML we can only guess...

Upvotes: 11

Alexandr Mihalciuc
Alexandr Mihalciuc

Reputation: 2577

The warning suggest that you have the td immediatly in table. td can be only withing tr tag

Upvotes: 2

Related Questions