why is my footer NOT responsive in layout ASP .NET core?

Viewed 71

I have a problem when I show a table in my view and it shows that bellow the footer and it has a very bad shape in various scales even in scaffolded pages. I use bootswatch theme and here is my _layout.cshtml code. but I think the header is ok and when I run my app on Production Mode the footer is even worst. it is going to the center of the screen!!

  <!DOCTYPE html>
   <html lang="en">
    <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - آزمون سنج دقیق</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/Azmoon.styles.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/BootsWatchTheme.css" />
</head>
<body>
    <header>
        <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
            <div class="container-fluid">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">آزمون سنج دقیق</a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
                    <ul class="navbar-nav flex-grow-1">
                        <li>
                            @*<img src=@Url.Content("Sources/Screenshot.jpg") height="45" width="45" />*@
                            <img src="~/Sources/Screenshot.jpg" height="45" width="45" />
                        </li>
                        <li class="nav-item">
                            <a class="nav-link " asp-area="" asp-controller="Home" asp-action="Index">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link " asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
                        </li>
                    </ul>
                    <partial name="_LoginPartial" />
                </div>
            </div>
        </nav>
        <link href="~/css/mvc-grid/mvc-grid.css" rel="stylesheet">
    </header>
    <div class="container">
        <main role="main" class="pb-3">
            @RenderBody()
            <script src="~/js/mvc-grid/mvc-grid.js"></script>
        </main>
    </div>

    <footer class="border-top footer text-muted bg-light">
        <div class="container">
            &copy; 2022 - Azmoon - <a asp-area="" asp-controller="Home" asp-action="ContactUs">ContactUS</a>
        </div>
    </footer>
    <script>
        document.querySelectorAll(".mvc-grid").forEach(element => new MvcGrid(element));
    </script>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>

to see a picture

1 Answers

This may be caused by your CSS style override.

Find the css styles for body in your BootsWatchTheme.css file,and add this line:

body {
   //"60px" can be replaced with your footer height
   margin-bottom: 60px !important;
}
Related