asp.net - 这个表结构如何实现DIV

标签 asp.net html css

enter image description here

我正在尝试使用 div 复制此表结构。

<asp:Table ID="tblAnnualReportServiceForm" runat="server" Width="100%" CellSpacing="1" CellPadding="5">
    <asp:TableRow >
        <asp:TableCell HorizontalAlign="Left">
            <asp:Table ID="Table1" runat="server" CellSpacing="1" CellPadding="5">
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:Label ID="lblStartDate" runat="server" Text="Start Date"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txtStartDate" Width="130px" runat="server"></asp:TextBox>
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow >
                    <asp:TableCell>
                        <asp:Label ID="lblEndDate" runat="server" Text="End Date"></asp:Label>
                    </asp:TableCell>
                    <asp:TableCell>
                        <asp:TextBox ID="txtEndDate" runat="server" Width="130px" style="text-align:left" ValidationGroup="MKE" />
                    </asp:TableCell>
                </asp:TableRow>             
            </asp:Table>
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>

我试过下面的 DIV,我没有太多的 CSS 经验。

<div>
    <div  style="float:left">
         <asp:Label ID="Label1" runat="server" Text="Start Date"></asp:Label>
    </div>
    <div>
        <asp:TextBox ID="TextBox1" Width="130px" runat="server"></asp:TextBox>
   </div>    
   <div>
        <asp:Label ID="Label2" runat="server" Text="End Date"></asp:Label>
        <asp:TextBox ID="TextBox2" runat="server" Width="130px" style="text-align:left" ValidationGroup="MKE" />
  </div>
</div>  

任何指针都会有很大帮助。我有太多需要转换为 DIV 的表结构。感谢您的帮助

最佳答案

复制表的一般结构是这样的。

<!--table-->
<div>
        <!--tr-->
        <div style="clear:both"></div>
                <!--td-->
                <div style="float:left">
                </div>
                <!--td-->
                <div style="float:right">
                </div>
        <!--tr-->
        <div style="clear:both"></div>
                <!--td-->
                <div style="float:left">
                </div>
                <!--td-->
                <div style="float:right">
                </div>
        <!--tr-->
        <div style="clear:both"></div>
</div>

关于asp.net - 这个表结构如何实现DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13200768/

相关文章:

asp.net - 大型 Web 应用程序中的 HTTP Keep Alive

html - 将背景应用于 flex 子项无法正常工作

html - 如何使用 CSS 将环绕元素扩展到整个浏览器宽度?

html - 用户代理样式表覆盖站点样式

asp.net - 如何使用 ASP.NET 添加客户端 (JavaScript) 确认消息框?

asp.net - ASP.MVC 中的忽略路由

javascript - 如何在扩展中使用 CSS 更改表格导航栏?

css - 使用 AngularJS 动态更改 css 类的属性

c# - asp.net 中的目录浏览器

html - 根据设备调整 div 大小