用fieldset标签来实现类似WinForm中GroupBox布局效果

fieldset标签以前都没用过,确切的讲是听都没听说过,今天参考ASP.Net Ajax的Document,看到它在举例子的时候网页中出现了类似于WinForm中GroupBox的东西,感觉布局一下子显得很有条理。感觉很不错,查看了源文件才知道原来是用了fieldset标签,其格式如下
<fieldset>
 
<legend>fieldset的标题,可以不要</legend>
</fieldset>

其实我个人认为如果在用户注册的界面上使用用fieldset布局可能效果会好一点,有些网站的必填项和选填项是混在一起的,如果用fieldset分开个人感觉更人性化吧。
<fieldset>
    
<legend>用户注册必填选项</legend>
    
<ul>
        
<li style="50px; display:inline;">
            
<asp:Label ID="Label1" Width="80px" runat="server" Text="用户名"></asp:Label></li>
        
<li style="150px; display:inline;">
            
<asp:TextBox ID="tbx_username" runat="server" Width="150px"></asp:TextBox></li>
    
</ul>
    
<ul>
        
<li style="50px; display:inline;">
            
<asp:Label ID="Label2" Width="80px" runat="server" Text="密码"></asp:Label></li>
        
<li style="150px; display:inline;"><asp:TextBox ID="tbx_password" runat="server" Width="150px"></asp:TextBox></li>
    
</ul>
    
<ul>
        
<li style="50px; display:inline;">
            
<asp:Label ID="Label3" Width="80px" runat="server" Text="密码确认"></asp:Label></li>
        
<li style="150px; display:inline;"><asp:TextBox ID="tbx_confirm" runat="server" Width="150px"></asp:TextBox></li>
    
</ul>
    
<ul>
        
<li style="50px; display:inline;">
            
<asp:Label ID="Label4" Width="80px" runat="server" Text="电子邮件"></asp:Label></li>
        
<li style="150px; display:inline;"><asp:TextBox ID="tbx_email" runat="server" Width="150px"></asp:TextBox></li>
    
</ul>
</fieldset>
<fieldset>
    
<legend>用户注册选添项</legend>
    
<ul>
        
<li style="50px; display:inline;">
            
<asp:Label ID="Label5" Width="80px" runat="server" Text="真实姓名"></asp:Label></li>
        
<li style="150px; display:inline;">
            
<asp:TextBox ID="tbx_realname" runat="server" Width="150px"></asp:TextBox></li>
    
</ul>
</fieldset>
原文地址:https://www.cnblogs.com/interboy/p/713592.html