Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
its a general discussion i want to know which way of writing the div is good for designing a web form.

for eg
1)
XML
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:TextBox ID="TextBox1" BorderColor="AliceBlue" runat="server"></asp:TextBox>
    </div>
      <div>
    <asp:TextBox ID="TextBox2" BorderColor="AliceBlue" runat="server"></asp:TextBox>
    </div>
    </form>

</body>
</html>


in the above code we don't have parent div tag we are having two div tag.

2nd eg

XML
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        </div>
     <div>
      <asp:Button ID="Button2" runat="server" Text="Button" />

     </div>
    </div>
    </form>
</body>
</html>


in the above example we are having a parent div and inside that there are two DIV

so i want to know which one is better in designing a form or both are same it dosent effect any thing such as zoom in or zoom out , minimize and maximize of screen.
Posted
Comments
CHill60 4-Jul-14 7:23am    
Try it and see!

1 solution

In my view, since both render same design on the browser screen, you can use any one. But still, i would go with the second one - the one with parent div tag because while we were in pre-div era, using tables for page structure, we used to have a td on the p tag, and have a tr on the td tag and obviously, a table on the tr tag.

So what i am trying to say is if i were you, i would go for a design that has parent tags for each of the child tag and i would not leave any div tag hanging in the garden without any support/parent tag.

This helps in adding any more tag in future as an when needed, without much design coding alterations.

Thanks
 
Share this answer
 
Comments
Raul Iloc 4-Jul-14 14:13pm    
I agree with you!
You have a 5 from me!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900