CSS保证金&页面宽度问题

时间:2011-07-19 08:40:31

标签: asp.net css

这是我的ASP.NET母版页:

问题是,当我将边距设置为零时,我的页面溢出,我在页面底部得到一个滚动条。有任何想法吗?

我将保证金设置为零的原因是因为我希望内容完全填满页面,以便我的ASP:Menu跨越整个页面。

<body style="padding:0; margin:0;">
<div>
    <form id="frmMaster" runat="server">
        <asp:ScriptManager runat="server" ID="scriptManagerID" EnablePageMethods="true" ScriptMode="Release"></asp:ScriptManager>

        <div id="header">
            <div id="headerTop">
                <div id="headerLeft">
                    <asp:Image ID="imgLogo" runat="server" ImageUrl="~/Images/Company_Logo.jpg" Height="80px" AlternateText="Logo" />
                </div>
                <div id="headerRight">
                    <asp:Menu ID="mnuMain" runat="server" OnMenuItemClick="mnuMain_MenuItemClick" Orientation="Horizontal" 
                        StaticDisplayLevels="1" MaximumDynamicDisplayLevels="3" SkinID="UserBar" >
                        <Items>
                            <asp:MenuItem Text="About" Value="About;list"></asp:MenuItem>
                            <asp:MenuItem Text="Config" Selectable="false">
                                <asp:MenuItem Text="Change Password" Value="ChangePassword;edit"></asp:MenuItem>
                                <asp:MenuItem Text="Customer Ranks" Value="ConfigCustomersRank;list"></asp:MenuItem>
                                <asp:MenuItem Text="Registration" Value="RegistrationInfo;list"></asp:MenuItem>                                
                            </asp:MenuItem>
                            <asp:MenuItem Text="Logout" Value="Logon;logout"></asp:MenuItem>
                        </Items>
                    </asp:Menu>
                    <asp:Label ID="lblMasterError" runat="server" ForeColor="Red" Text="Error" Visible="False"></asp:Label>
                    <asp:Label ID="lblUser" runat="server" ForeColor="Black" Text="User: " ></asp:Label>
                </div>
            </div>
        </div>

        <div id="menu" class="clear hideSkipLink">
            <asp:Menu ID="mnuModule" runat="server" OnMenuItemClick="mnuModule_MenuItemClick"
                Orientation="Horizontal" SkinID="Navigation" >
                <Items>
                    <asp:MenuItem Text="Home" Value="Home;list"></asp:MenuItem>
                    <asp:MenuItem Text="Calendar" Value="Calendar;month"></asp:MenuItem>
                    <asp:MenuItem Text="Customers" Value="Customers;list">
                        <asp:MenuItem Text="Create Customer" Value="Customers;create;0;;0;"></asp:MenuItem>
                    </asp:MenuItem>
                    <asp:MenuItem Text="Communications" Selectable="false">
                        <asp:MenuItem Text="Activities" Value="Activities;list">
                            <asp:MenuItem Text="Create Activity" Value="Activities;create"></asp:MenuItem>
                        </asp:MenuItem>
                        <asp:MenuItem Text="Emails" Value="Emails;list">
                            <asp:MenuItem Text="Create Email" Value="Emails;create"></asp:MenuItem>
                        </asp:MenuItem>
                        <asp:MenuItem Text="Meetings" Value="Meetings;list">
                            <asp:MenuItem Text="Create Meeting" Value="Meetings;create"></asp:MenuItem>
                        </asp:MenuItem>
                        <asp:MenuItem Text="Phone Communication" Value="PhoneComms;list">
                            <asp:MenuItem Text="Schedule Phone" Value="PhoneComms;create"></asp:MenuItem>
                        </asp:MenuItem>
                    </asp:MenuItem>
                    <asp:MenuItem Text="Transactions" Selectable="false">
                        <asp:MenuItem Text="Invoices" Value="Invoices;list"></asp:MenuItem>
                        <asp:MenuItem Text="Leads" Value="Leads;list">
                            <asp:MenuItem Text="Create Lead" Value="Leads;create"></asp:MenuItem>
                        </asp:MenuItem>
                        <asp:MenuItem Text="Opportunities" Value="Opportunities;list">
                            <asp:MenuItem Text="Create Opportunity" Value="Opportunities;create"></asp:MenuItem>
                        </asp:MenuItem>
                        <asp:MenuItem Text="Quotes" Value="Quotes;list">
                            <asp:MenuItem Text="Create Quote" Value="Quotes;create"></asp:MenuItem>
                        </asp:MenuItem>
                    </asp:MenuItem>
                    <asp:MenuItem Text="Reports" Selectable="false">
                        <asp:MenuItem Text="Contracts For Renewal" Value="CTRTContractsForRenewal;list"></asp:MenuItem>
                    </asp:MenuItem>
                </Items>
            </asp:Menu>
        </div>

        <asp:ContentPlaceHolder ID="mainContent" runat="server"></asp:ContentPlaceHolder>

    </form>
</div>

1 个答案:

答案 0 :(得分:1)

问题是在内容页面(不是主页)中,有以下代码:

<asp:Panel ID="pnlHeader" runat="server" SkinID="None" CssClass="Panel_Page_Header" >
    <asp:Label ID="lblHome" runat="server" Text="Home" SkinID="None" CssClass="Label_Page_Header" ></asp:Label>
</asp:Panel>

Label_Page_Header类具有以下属性

padding: 5px;
width: 100%;

使用填充,宽度:100%将标签拉伸到页面边缘。