2016-03-31 19 views
2

Visual Studio 2015, C# ve .NET Framework 4.6.1 ile bir ASP.NET MVC 5 uygulaması geliştiriyorum.Sayfanın altındaki altbilgiyi göster her zaman

Bu _Layout.cshtml sayfası vardır:

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title>@ViewBag.Title - My product</title> 
    @Styles.Render("~/Content/css") 
    <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900' rel='stylesheet' type='text/css'> 
    <link href="~/css/common.css" rel="stylesheet" type="text/css" media="all" /> 
    @RenderSection("Styles", required: false) 
    @Scripts.Render("~/bundles/modernizr") 
</head> 
<body> 
    <div class="header_bg"> 
     <div class="wrap"> 
      <div class="header"> 
       <div class="logo"> 
        <img src="~/images/logo.png" alt="" /><br /> 
        <span>Versi&oacute;n 2.0</span> 
       </div> 
       <div class="nav"> 
        ¡Hola, @User.Identity.Name! 
       </div> 
       <div class="clear"> </div> 
      </div> 
     </div> 
    </div> 
    <div class="container body-content"> 
     @RenderSection("Body") 
     <hr /> 
     <footer> 
      <p style="font-size:20px">&copy; @DateTime.Now.Year - My Company</p> 
     </footer> 
    </div> 

    @Scripts.Render("~/bundles/jquery") 
    @Scripts.Render("~/bundles/bootstrap") 
    @RenderSection("scripts", required: false) 
</body> 
</html> 

Bütün sayfalar dikey kaydırma olmaz ve ben sayfanın alt kısmında her zaman <footer> göstermek istiyorum.

Bunu nasıl yapabilirim?

+1

Kontrol https://getbootstrap.com/examples/sticky-footer/ – Dandy

+1

istediğini temizleyin ama bak Değil [burada cevaplar] (http://stackoverflow.com/questions/42294/how-do-you-get-the-footer-to-stay-at-the-bottom-of-a-web-page) –

cevap

2
almak

footer{ 
 
position:fixed; 
 
    bottom:0; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta charset="utf-8" /> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <title>@ViewBag.Title - My product</title> 
 
    @Styles.Render("~/Content/css") 
 
    <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900' rel='stylesheet' type='text/css'> 
 
    <link href="~/css/common.css" rel="stylesheet" type="text/css" media="all" /> 
 
    @RenderSection("Styles", required: false) 
 
    @Scripts.Render("~/bundles/modernizr") 
 
</head> 
 
<body> 
 
    <div class="header_bg"> 
 
     <div class="wrap"> 
 
      <div class="header"> 
 
       <div class="logo"> 
 
        <img src="~/images/logo.png" alt="" /><br /> 
 
        <span>Versi&oacute;n 2.0</span> 
 
       </div> 
 
       <div class="nav"> 
 
        ¡Hola, @User.Identity.Name! 
 
       </div> 
 
       <div class="clear"> </div> 
 
      </div> 
 
     </div> 
 
    </div> 
 
    <div class="container body-content"> 
 
     @RenderSection("Body") 
 
     <hr /> 
 
     <footer> 
 
      <p style="font-size:20px">&copy; @DateTime.Now.Year - My Company</p> 
 
     </footer> 
 
    </div> 
 

 
    @Scripts.Render("~/bundles/jquery") 
 
    @Scripts.Render("~/bundles/bootstrap") 
 
    @RenderSection("scripts", required: false) 
 
</body> 
 
</html>

İlgili konular