Reputation: 1902
I'm using dotnetcore and ASP MVC. The problem is that I don't know how to serve correctly my css and images files. Here you can see the file structure:
Here is the Shared layout's head.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Galeria de comics">
<title>@ViewBag.Title - Galeria de comics</title>
<link rel="stylesheet" href="~/wwwroot/css/normalize.css">
<link rel="stylesheet" href="~/wwwroot/css/main.css">
</head>
<body>
<header class="main-header"></header>
@RenderBody()
</body>
</html>
I'm called this layout in a View.
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "Libro comic detalle";
}
What's the problem? The problem is that the CSS files aren't serve so I can't see the styles. Any solition?
Upvotes: 1
Views: 1235
Reputation: 1902
Seems I miss the href attribute's content. You should skip the wwwroot
folder since the static files are served as http://app/css/cssFileName
. Example: http://yoursite.com/css/main.css
, same with images and js files.
Here I fixed the problem:
<link rel="stylesheet" href="~/css/normalize.css">
<link rel="stylesheet" href="~/css/main.css">
If you want to know more visit this link
Upvotes: 1