0

Hey I tried to make a page in Asp.Net Core and I want to put an image in the background but the way I tried wasn't very successfully.

<style>
    .body {
        background-image: url('..\pictures\mypicture.jpg');
    }
</style>

Or when I tried to make a normal picture it didn't work either:

<img src="..\picture\mypicture.png"/>
1
  • put the pictures folder under wwwroot and make sure you have app.UseStaticFiles() in startup. Commented Mar 4, 2020 at 12:48

1 Answer 1

1

first make sure your picture folder is in wwwroot and make sure you have app.UseStaticFiles() in startup. ,after than, try this :

<img src="/picture/mypicture.png"/>

or

<style>
   .body {
          background-image: url('~/pictures/mypicture.jpg');
         }
</style>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.