custom header and footer in ASP.NET Core MVC project

elsvieta 371 Reputation points
2023-10-16T18:25:05.8666667+00:00

hi all,

I just created my first Asp.Net Core MVC project. I am trying to customize my site background.

I created a folder images and I copied a bunch of .png files there. I intend to use one of the .png files as a background for the footer. Where is the best place to add code so that I add the picture to the footer?

I tried:

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
	back
	background-image: url("/images/LOGO_01.png");
}

in _Layout.cshtml.css

and I also tried the same in site.css.

The project launches but the background pic does not show up.

Thanks,
elsvieta

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,816 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 75,871 Reputation points Moderator
    2023-10-16T18:48:34.39+00:00

    by default the content root is the wwwroot folder. move the images folder to the wwwroot folder.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-10-17T03:11:04.2+00:00

    Hi,@elsvieta

    You could check your console( any 404 error) of browser if the image has been served,if its' ok, add the css codes in your _Layout.cshtml.css

    it was not served, check if your check your images folder locates in wwwroot folder ,also check app.UseStaticFiles() middleware , if you modified the requestpath of StaticFileOptions or content root path of file providers.

    For more details,you could check this document related

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.