CSS 页脚将取代右侧

标签 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

最佳答案

您可以将以下内容添加到页脚: style="position: fixed; bottom: 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>

注意:您无需在页脚中说明 min-height: 10%,这是隐含的。

关于CSS 页脚将取代右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23968950/

相关文章:

c# - 在什么情况下应该设置动态控件属性?

asp.net - 在 ASP.NET MVC( View )中包含 WebForms?

html - 垂直居中在 Mozilla 下不起作用

jquery - Bootstrap 3 选项卡内容溢出页脚

java - 将网格上的帖子更改为固定大小(照片帖子下方有文字。)

asp.net - 我可以在没有 SQL 托管计划的情况下访问 MS Access 文件作为 ASP.NET 站点的数据库吗?

c# - 连接中的 Entity Framework 子查询

javascript - 让 IE text-shadow polyfill 与 Modernizr 一起工作

c# - ASP.Net:带有内容区域的用户控件,这显然是可能的,但我需要一些细节

c# - 将表单标记添加到 ASP.Net Webforms 页面时出现空堆栈错误