CSS页脚代替右侧

时间:2014-05-31 10:30:33

标签: css asp.net webforms

我的页脚有问题,因为我将页面分割如下:

<%@ Page Title="" Language="C#" MasterPageFile="~/SVM.Master" AutoEventWireup="true" CodeBehind="Cateshow.aspx.cs" Inherits="beravoSV.Cateshow" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style8 {
            color: #333333;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="midcont">
        <div class="leftsidemainadsshow">
            <br />
            <asp:ListView ID="cateshowlistview" runat="server" DataSourceID="categoryshowsql" Style="text-align: left">
                <ItemTemplate>
                    <div class="templist">
                        <asp:LinkButton ID="Adstitlinkbtn" runat="server"
                            Style="font-weight: 700; color: #0066FF" Text='<%# Eval("AdsTit") %>'
                            CssClass="adstit" OnClick="Adstitlinkbtn_Click"
                            PostBackUrl='<%# "AdsDetails.aspx?AdsTit=" + Eval("AdsID") %>'></asp:LinkButton>
                        <br />
                        <asp:ImageButton ID="ImageButton3" runat="server" Height="88px" Width="91px"
                            CssClass="imag1" ImageUrl='<%# "/images/AdsImgs/" + Eval("Img1") %>'
                            PostBackUrl='<%# "AdsDetails.aspx?Img1=" + Eval("AdsID") %>' />
                        <br />
                        <asp:Label ID="AdsDescLabel" runat="server" Text='<%# Eval("AdsDesc") %>'
                            CssClass="adsdisc" />
                        <br />
                        <br />
                        <br />
                        <br />
                        <asp:Label ID="Sectlbl" runat="server" Text='<%# Eval("Section") %>'
                            Style="color: #333333"></asp:Label>
                        -
                    <asp:Label ID="categlbl" runat="server" Text='<%# Eval("Category") %>'
                        Style="color: #333333; font-weight: 700; font-style: italic;"></asp:Label>
                        <br />
                        <asp:Label ID="CountryLabel" runat="server" Text='<%# Eval("Country") %>'
                            Style="color: #333333" />
                        &nbsp;-
                <asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>'
                    Style="color: #333333" />
                        &nbsp;-
                <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>'
                    Style="color: #333333" />
                        <div class="adsprice">
                            <span class="style8">Price:</span>
                            <asp:Label ID="AdsPriceLabel" runat="server" Style="color: #FF0000"
                                Text='<%# Eval("AdsPrice") %>' />
                        </div>
                        <div class="iconadsbox">
                            <asp:ImageButton ID="Likebtn" runat="server"
                                ImageUrl="~/iconsimg/favoritestar2.png" OnClick="Likebtn_Click" />
                            &nbsp;&nbsp;
                           <asp:ImageButton ID="sendmailbtn" runat="server"
                               ImageUrl="~/iconsimg/mailposter.png" OnClick="sendmailbtn_Click" />
                        </div>
                        <asp:Image ID="Image1" runat="server" CssClass="divideline" />
                        <br />
                    </div>
                </ItemTemplate>
                <LayoutTemplate>
                    <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                    <asp:DataPager ID="DataPager2" runat="server" PagedControlID="cateshowlistview" PageSize="7">
                        <Fields>
                            <asp:NumericPagerField />
                            <asp:NextPreviousPagerField />
                        </Fields>
                    </asp:DataPager>
                </LayoutTemplate>
            </asp:ListView>
        </div>
        <div class="primumads">
        </div>
        <br />
        <br />
        <asp:SqlDataSource ID="categoryshowsql" runat="server"
            ConnectionString="<%$ ConnectionStrings:BeravaConnectionString %>"
            SelectCommand="SELECT DISTINCT [AdsID],[Section], [Category], [Country], [State], [City], [AdsTit], SUBSTRING([AdsDesc],1,155) as AdsDesc, [AdsPrice], [Img1] FROM [ads] WHERE (([Category] = @Category) AND ([Country] = @Country))">
            <SelectParameters>
                <asp:QueryStringParameter Name="Category" QueryStringField="cat"
                    Type="String" />
                <asp:SessionParameter Name="Country" SessionField="location" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
    <br />
</asp:Content>

当右侧是空的时,页脚会上升,如果它已满,它将会下降到底部。即使右侧是空的,我怎么能让它永远失效呢?

您可以找到以下链接,了解我的更多信息 enter link description here

1 个答案:

答案 0 :(得分:0)

您可以添加以下内容: style =&#34; position:fixed;底部:0; width:100%(这会将页脚固定在屏幕底部)

如果要将页脚固定到页面的末尾,则需要在页面和页面内容中指定最小高度,这是一个示例:

<div id="header" style="min-height: 10%"></div>
<div id="content" style="min-height: 80%"></div>
<div id="footer" style="min-height: 10%"></div>

注意:你不需要说最小高度:页脚占10%,这是隐含的。