简体   繁体   中英

How to properly add and browse images from image folder of web project in visual studio

I created an image folder in my first web application(web-forms) and copied images into that folder, I want to set a background image on div. I followed following steps opened properties (div) 1. click style tab 2. select background-image 3. select images folder

But Content folder is not showing any image, its empty. I am beginner and unable to get where I am mistaken. 在此处输入图片说明

You need to include into de project the images you just copied to the images folder. For that you need to click onto the little button to the right of the update (blue one) in the solution explorer top bar and that will show all the files that are not included. Then you select all the images needed -> right click -> include files.

After that repeat the process you did and the imagess should show.

Hope this helps!

Are you sure its same folder ? Reset visual studio and windows , but if you want doing this on code-side

create a css file and look at this code

body {
    background-image:url('images/background.png');    
}

Problem resolved. Right click on 'Images' folder, click 'Add' add and existing item, then I searched for images folder into project directory and added desired images.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM