Sohail
Sohail

Reputation: 780

How do I correct html4 4.01 in asp.net using vs2012

In vs 2012 asp.net empty site I am using html4.01 for table desgin I have a <div> (a couple actually) and i keep getting a warning that reads:

    </div>
    <div style="text-align:center;">
       <table style="text-align:left; border-color:aqua;background-color:gold;border-width:2px;"cellspacing ="0" cellpadding ="8" rules ="none" width ="540">
        <tr>
            <td valign ="top">
                Me
            </td>
        </tr>
    </table>
    </div>


Warning 1   Validation (HTML 4.01): Element 'tr' cannot be nested within element 'div'. 

what would cause this?

Upvotes: 0

Views: 379

Answers (1)

Spudley
Spudley

Reputation: 168803

Looking at the code you've posted:

You have a table, and the nesting looks like you intended to put the <tr> inside it.

However, the table is closed on the same line as it is started, so the <tr> is actually outside the table, after it.

Find the closing </table> tag, and move it to where it should be, after the rest of the code that is meant to be inside the table.

[EDIT]
Okay, you've now fixed that in the code in the question.

The next problem I can see is that your table tag has the following:

border-width:2px;"cellspacing ="0"
                ^^^
          missing space here

The missing space before the cellspacing attribute will cause the tag to be invalid, which could also be breaking it.

For further HTML validation, I recommend you put your HTML code through the W3C's validator, which will highlight any further issues you may have with your HTML.

Upvotes: 1

Related Questions