After making a new .NET8.0 Razor Pages (ASP.NET Core) project, I removed JQuery- and Bootstrap-Libraries. Then I edited _Layout.cshtml.css. When running the project, my CSS-rules are not applied, because my browser cannot load the stylesheet. The browser gets a 404 as result, when requesting {application}.styles.css.
Does anyone know what the issue is?
The _Layout.cshtml and _Layout.cshtml.css look like this:
:root {
}
@font-face {
font-family: "Inter";
src: url(/fonts/Inter/Inter-VariableFont_slnt,wght.ttf);
}
@font-face {
font-family: "Cutive Mono";
src: url(/fonts/Cutive_Mono/CutiveMono-Regular.ttf);
}
html {
font-family: Inter;
box-sizing: border-box;
}
body {
height: 100vh;
width: 100vw;
margin: 0;
display: grid;
grid-template-rows: 4.4rem 1fr 1.5rem;
}
header {
display: grid;
grid-template-rows: 1fr 1.5rem;
}
.main-header {
background-color: blue;
}
.main-nav {
background-color: black;
color: white;
display: flex;
align-items: center;
}
.main-nav-item {
margin-left: 0.2rem;
color: inherit;
text-decoration: inherit;
}
<!DOCTYPE html>
<html lang="de-de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"]</title>
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/{application}.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<div class="main-header"></div>
<nav class="main-nav">
<a href="#" class="main-nav-item">Link 1</a>
<a href="#" class="main-nav-item">Link 2</a>
</nav>
</header>
<main>
@RenderBody()
</main>
<footer>
</footer>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
wwwroot looks like this: