I've been trying to set a background image for all the pages in my web application, but I've encountered some difficulties. I'm using an ASP.NET Core web app with razor pages and have bootstrap installed via NuGet, which provided me with a site.css file.
In my site.css file, I included the following code:
#HomepageBody{
background-image: url("Images/cloud-1581.jpg");
background-repeat: no-repeat;
background-position: center;
}
Additionally, in my Shared/_Layout.cshtml file, this is what I have:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - CustomerPageTest</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body id="HomepageBody">
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">CD Insights</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-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 flex-sm-row-reverse">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Customer/List">Add Assessment</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
Although I've added the ID to the body, nothing seems to change when the web app is running. Any suggestions on how I can resolve this issue?