10 Replies - 1231 Views - Last Post: 21 February 2014 - 01:18 PM

Adding Background images into CSS using Netbeans

I am trying to create a website, and in doing so I would like to set a background image for all the pages.

So I know the code:

body {background-image:url('JuliaWebSiteBackground.jpeg');}

What I need to figure out how to do is get the image into a file on NetBeans so my web app can find it. I tried to drag and drop from my desktop, but I can't seem to find where it went. Also googled videos for the past hour and they all seem to reference Jpanel background images, which is not what I am looking to do.

Re: Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 02:41 PM

Ignoring NetBeans for the moment, the image needs to be at the same location as the web page that refers to it, or at the same location as the css-file that refers to it if this is in a subfolder. So you could use Windows Explorer or equivalent to copy the file to the correct location.

I feel sure that you could drag and drop into either the Projects or Files Window/Panel in NetBeans, or right-click and perhaps New.. File; but if you are struggling then just use Windows Explorer. Or (in NetBeans) try copy/paste rather than dragging.

Re: Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 11:57 PM

So when you preview your web page the image should show - provided it is saved in the same location and has the correct filename. If not, there will be an error in your browser's console saying it can't find the image.

Re: Adding Background images into CSS using Netbeans

Posted 21 February 2014 - 08:01 AM

For some reason my source file was missing so I couldn't store the image in the file. SO I just made a new file and copy pasted everything and it ended up working.

Now how do I get the background image to take up the entire image. Right now it takes up 75% of the screen and the other 25% is taken up by the same image. WOuld like 100% of the page to be just the one image and not two.