How can it work without a closing tag


T

Tony Johansson

Hello!

Here is an example and as you can see I have no closing tag on element table
and it works just fine how is that possible ?
Can somebody explain that.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>

<body>
<form id="form1" runat="server">
<asp:Repeater ID="MyFriends" runat="server">
<HeaderTemplate>
<table style="border: 1px double #000000;">
<tr style="background-color: #00FF00;">
<td>First Name</td>
<td>Last Name</td>
<td>Telephone</td>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr style="background-color: #FFFF00">
<td><%# Eval("fname")%></td>
<td><%# Eval("lname")%></td>
<td><%# Eval("phone")%></td>
</tr>
</ItemTemplate>

<AlternatingItemTemplate>
<tr style="background-color: #00FF00">
<td><%# Eval("fname")%></td>
<td><%# Eval("lname")%></td>
<td><%# Eval("phone")%></td>
</tr>
</AlternatingItemTemplate>
</asp:Repeater>
</form>
</body>
</html>

//Tony
 
Ad

Advertisements

J

Jeff Johnson

Here is an example and as you can see I have no closing tag on element
table and it works just fine how is that possible ?
Can somebody explain that.

Browsers are very forgiving.
 
Ad

Advertisements

L

Lee J. Moore

Hello!

Here is an example and as you can see I have no closing tag on element
table and it works just fine how is that possible ? Can somebody explain
that.

There is enough information there to render the table, and no additional
complex html to confuse the rendering engine before the </body> tag.

Also, internet browsers try to render bad code by design. If they didn't,
more than half the internet wouldn't work because few sites are W3C
compliant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top