0

我的页面的 HTML 表格代码在这里。
它不会自动调整。我需要删除多余的空格,它们之间只需要保留 5% 的空间。

<table width="95%">
            <tr>
                <td align="left">
                    <asp:Button ID="btnTargetVsActual" runat="server" Text="Target Vs Actual" CssClass="selectedButton"
                        Width="200px" OnClientClick="javascript:return SetFilterAndChart('ctl00_CPHFFR_btnTargetVsActual');" />
                    <asp:Button ID="btnKPIActivities" runat="server" Text="KPI Activities" CssClass="unSelectedButton"
                        Width="200px" OnClientClick="javascript:return SetFilterAndChart('ctl00_CPHFFR_btnKPIActivities');" />
                </td>
            </tr>
            <tr>
                <td style="width: 100%;white-space: nowrap;">
                    <asp:Panel ID="pnlMain" runat="server" BorderColor="Navy" BorderWidth="2">
                        <asp:UpdatePanel runat="server" ID="UpdFilters" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Panel ID="pnlFilterCriteria" runat="server" GroupingText="Filter Criteria" BorderWidth="1">
                                    <table width="100%">
                                        <tr>
                                            <td align="center" id="tdlblYear">
                                                <asp:Label ID="lblYear" runat="server" Text="Year" CssClass="Label"></asp:Label>
                                            </td>
                                            <td align="center" id="tdlblMonth">
                                                <asp:Label ID="lblMonth" runat="server" Text="Month" CssClass="Label"></asp:Label>
                                            </td>
                                            <td align="center" id="tdlblCountry">
                                                <asp:Label ID="lblCountry" runat="server" Text="Country" CssClass="Label"></asp:Label>
                                            </td>
                                            <td align="center" id="tdlblDivision">
                                                <asp:Label ID="lblDivision" runat="server" Text="Team" CssClass="Label"></asp:Label>
                                            </td>
                                            <td align="center" id="tdlblPosition">
                                                <asp:Label ID="lblPosition" runat="server" Text="Position" CssClass="Label"></asp:Label>
                                            </td>
                                            <td align="center" id="tdlblClass" >
                                                <asp:Label ID="lblClass" runat="server" Text="Class" CssClass="Label"></asp:Label>
                                            </td>
                                            <td align="center" id="tdlblSpecialty">
                                                <asp:Label ID="lblSpecialty" runat="server" Text="Specialty" CssClass="Label"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr style ="white-space: nowrap;">
                                            <td align="left" valign="top">
                                                <asp:DropDownList ID="ddlYear" runat="server" CssClass="dropDownList" Width="98%" >
                                                </asp:DropDownList>
                                            </td>
                                            <td align="left" valign="top">
                                                <asp:Panel ID="pnlMonth" ScrollBars="Auto" runat="server" Height="95px" BorderColor="#003973"
                                                    BorderWidth="1px" Width="95%">
                                                    <asp:CheckBoxList ID="cblMonth" runat="server" CssClass="checkboxlist">
                                                    </asp:CheckBoxList>
                                                </asp:Panel>
                                            </td>
                                            <td align="left" valign="top">
                                                <asp:DropDownList ID="ddlCountry" runat="server" CssClass="dropDownList" Width="95%"
                                                    AutoPostBack="true">
                                                </asp:DropDownList>
                                            </td>
                                            <td align="left" valign="top">
                                                <asp:Panel ID="pnlDivision" ScrollBars="Auto" runat="server" Height="95px" BorderColor="#003973"
                                                    BorderWidth="1px" Width="95%">
                                                    <asp:CheckBoxList ID="cblDivision" runat="server" CssClass="checkboxlist" AutoPostBack="true">
                                                    </asp:CheckBoxList>
                                                </asp:Panel>
                                            </td>
                                            <td align="left" valign="top">
                                                <asp:UpdatePanel ID="upPosition" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:Panel ID="pnlPosition" ScrollBars="Auto" runat="server" Height="95px" BorderColor="#003973"
                                                            BorderWidth="1px" width="95%">
                                                            <asp:CheckBoxList ID="cblPosition" runat="server" CssClass="checkboxlist">
                                                            </asp:CheckBoxList>
                                                        </asp:Panel>
                                                    </ContentTemplate>
                                                    <Triggers>
                                                        <asp:AsyncPostBackTrigger ControlID="cblDivision" EventName="SelectedIndexChanged" />
                                                    </Triggers>
                                                </asp:UpdatePanel>
                                            </td>
                                            <td align="left" valign="top" >                                        
                                                <center>
                                                <asp:Panel ID="pnlClass" runat="server" Height="95px" BorderColor="#003973" BorderWidth="1px"
                                                    Width="35%">                                                
                                                    <asp:CheckBoxList ID="cblClass" runat="server" CssClass="checkboxlist">
                                                    </asp:CheckBoxList>
                                                </asp:Panel>
                                                </center>                                         
                                            </td>
                                            <td align="left" valign="top">
                                                <asp:UpdatePanel ID="upSpecialty" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <asp:Panel ID="pnlSpecialty" ScrollBars="Auto" runat="server" Height="95px" BorderColor="#003973"
                                                            BorderWidth="1px" >
                                                            <asp:CheckBoxList ID="cblSpecialty" runat="server" CssClass="checkboxlist">
                                                            </asp:CheckBoxList>
                                                        </asp:Panel>

                                                    </ContentTemplate>
                                                    <Triggers>
                                                        <asp:AsyncPostBackTrigger ControlID="cblDivision" EventName="SelectedIndexChanged" />
                                                    </Triggers>
                                                </asp:UpdatePanel>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="ddlCountry" EventName="SelectedIndexChanged" />
                            </Triggers>
                        </asp:UpdatePanel>
                        <table width="100%">
                            <tr>
                                <td align="center" style="padding: 5px;">
                                    <asp:Button ID="btnGo" runat="server" Text="GO" CssClass="button" />
                                </td>
                            </tr>
                        </table>
                        <table id="tblTargetVsActual" width="100%" runat="server">
                            <tr>
                                <td align="center">
                                    <div id="divSellingDays">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <div id="divFrequency">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <div id="divCoverage">
                                    </div>
                                </td>
                            </tr>
                        </table>
                        <table id="tblKPIActivities" width="100%" runat="server">
                            <tr>
                                <td style="width: 50%;" valign="top">
                                    <div id="divCallVolume">
                                    </div>
                                </td>
                                <td style="width: 50%;" valign="top">
                                    <div id="divFrequencyByDoctor">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;" valign="top">
                                    <div id="divCallVolumeByClass">
                                    </div>
                                </td>
                                <td style="width: 50%;" valign="top">
                                    <div id="divDoctorCoverageByClass">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;" valign="top">
                                    <div id="divFrequencyByClass">
                                    </div>
                                </td>
                                <td style="width: 50%;" valign="top">
                                    <div id="divDailyCallRate">
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
        </table>

并生成此代码的输出,如下所示 在此处输入图像描述

我需要消除这些差距并将空间分配给“位置”和“专业”。

提前致谢!--------------编辑----- CSS规则

.dropDownList

    {
        font-size: 11px;
        font-style: normal; /*font-family: Verdana, Arial, Helvetica, sans-serif;*/
        font-family: Arial;
        color: Navy;
        border: Solid;
        border-color: Navy;
        border-width: 1px;
        width: 150px;
        line-height: 12px;
        height: 20px;
        vertical-align: top;
    }
    .checkboxlist
    {
        font-size: 11px;
        font-style: normal;
        /*font-family: Verdana, Arial, Helvetica, sans-serif;*/
        font-family: Arial;
    }
4

1 回答 1

0

为什么不让选择值的表格看起来像这样:

<table width="100%">
<tr width="100%">
    <td width="14%">Year</td>
    <td width="14%">Month</td>
    <td width="14%">Country</td>
    <td width="14%">Team</td>
    <td width="16%">Position</td>
    <td width="7%">Class</td>
    <td width="16%">Speciality</td>
</tr>    

<tr width="100%">
    <td width="14%">2013</td>
    <td width="14%">January<br />June</td>
    <td width="14%">All countries</td>
    <td width="14%">All teams</td>
    <td width="16%">Position</td>
    <td width="7%">A</td>
    <td width="16%">All speciality</td>
</tr>    

使行中的每个单元格以百分比(行的百分比)相同宽度,班级更小,职位和专业更宽。

演示:http: //jsfiddle.net/goodfriend/XXSMA/2/

我只做了基本表。我没有你的资源,但你的代码的实现应该不是问题。

我还注意到您为班级分配了 35% 的宽度。也许如果您将 125% 的精力放在职位和专长上,它也可能会起作用。但我认为将行的 100% 部分划分为行中的每个单元格会更好。

于 2013-05-23T11:24:33.850 回答