-1

我的情况很奇怪,我相信人们在这个特定问题上帮助我一定很容易。我在一个子页面上有两个 div,我想彼此相邻显示。我的意思是,一个在左边,一个在右边。之后,我想在屏幕底部显示一个覆盖 100% 宽度的表格。

我在一个 div 上使用了向左浮动并在另一个 div 上向右浮动。然后我在底部显示表格的标题,然后显示表格。
我的问题是,尽管我付出了所有努力,但标题仍显示在这两个 div 之间。这是我的代码。

   <div id="ContainerDiv" runat="server" style="width: 930px">
        <div id="DivticketDetails" runat="server" visible="false" 
            style="float: left; width: 400px;">
            <asp:Panel ID="PanelTicketDetails" runat="server" BackColor="#8B9FBE">
                <h3 style="color: #FFFFFF; font-weight: bold; text-decoration: underline;">
                    Bowzer Details</h3>
                <table border="1" cellpadding="0" cellspacing="0" class="myTable">
                    <tr>
                        <td bgcolor="#507CD1">
                            <asp:Label ID="Label6" runat="server" Text="Field / Customer Name" Font-Bold="True"
                                Font-Size="XX-Small" BorderColor="#507CD1" ForeColor="White"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbl_FieldName" runat="server" Text="lbl_FieldName" CssClass="myLabel"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#507CD1">
                            <asp:Label ID="Label3" runat="server" Text="Challan Generated On" Font-Bold="True"
                                Font-Size="XX-Small" BorderColor="#507CD1" ForeColor="White"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbl_firstEntryDate" runat="server" Text="lbl_firstEntryDate" Font-Size="Small"
                                CssClass="myLabel"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#507CD1">
                            <asp:Label ID="Label4" runat="server" Text="Product Name" Font-Bold="True" Font-Size="XX-Small"
                                BorderColor="#507CD1" ForeColor="White"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbl_ProductName" runat="server" Text="lbl_ProductName" Font-Size="Small"
                                CssClass="myLabel"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#507CD1">
                            <asp:Label ID="Label2" runat="server" Text="Bowzer No" Font-Bold="True" Font-Size="XX-Small"
                                BorderColor="#507CD1" ForeColor="White"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbl_bowzerNo" runat="server" Text="lbl_bowzerNo" Font-Size="Small"
                                CssClass="myLabel"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#507CD1">
                            <asp:Label ID="Label28" runat="server" Text="Quantity" Font-Bold="True" Font-Size="XX-Small"
                                BorderColor="#507CD1" ForeColor="White"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbl_BowQuantity" runat="server" Text="lbl_BowQuantity" Font-Size="Small"
                                CssClass="myLabel"></asp:Label>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </div>
        <div id="Div2" runat="server" style="float: right; width: 429px;">
            <asp:Panel ID="PanelBowzerHistory" runat="server" BackColor="#8B9FBE" Visible="False">
                <h3 style="font-weight: bold; text-decoration: underline; color: #FFFFFF">
                    Bowzer History
                </h3>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    DataKeyNames="challan_id" DataSourceID="DSBowzerHistory" Font-Size="Smaller"
                    ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize="4">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="FirstWeight" HeaderText="FirstWeight" SortExpression="FirstWeight" />
                        <asp:BoundField DataField="Firstentry_date" HeaderText="Firstentry_date" SortExpression="Firstentry_date" />
                        <asp:BoundField DataField="SecondWeight" HeaderText="SecondWeight" SortExpression="SecondWeight" />
                        <asp:BoundField DataField="netWeight" HeaderText="netWeight" SortExpression="netWeight" />
                        <asp:BoundField DataField="SecondEntry_Date" HeaderText="SecondEntry_Date" SortExpression="SecondEntry_Date" />
                        <asp:BoundField DataField="challan_id" HeaderText="challan_id" InsertVisible="False"
                            ReadOnly="True" SortExpression="challan_id" />
                    </Columns>
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#EFF3FB" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />
                </asp:GridView>
            </asp:Panel>
        </div>
    </div>

    <div id="tblDetailsDiv" runat="server" visible="False" title="Ticket Details" style="width: 930px;
        background-color: #8B9FBE;">
                <h3 style="font-size: medium; color: #FFFFFF; font-weight: bold; width: 930px; background-color: #00FF00;">
                Enter Details Here</h3>
            <table id="tblDetails" title="Enter Details" border="0" cellpadding="0" cellspacing="0"
                class="myTable" frame="border">
                <tr>
                    <td>

                    </td>
                    <td>
</table>
</div>

这是它的显示方式。

图片

4

1 回答 1

0

尝试将第二个 div 的浮动更改为向左,并在这两个 div 之后。像这样:

在此处输入图像描述

并在这两个 div 之后添加一个具有清晰样式的新 div。

<div style="clear: both"></div> 希望它有效。

给你。我添加了上面的代码

于 2013-01-24T06:13:42.600 回答