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

#1 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 08-July 13

Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 01:38 PM

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.

Any advice?

Is This A Good Question/Topic? 0
  • +

Replies To: Adding Background images into CSS using Netbeans

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10175
  • View blog
  • Posts: 37,578
  • Joined: 27-December 08

Re: Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 01:40 PM

Is this a Java question? Or are you just using NetBeans as your IDE as you develop the front-end (HTML/CSS) of your site?
Was This Post Helpful? 0
  • +
  • -

#3 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 08-July 13

Re: Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 01:47 PM

View Postmacosxnerd101, on 20 February 2014 - 01:40 PM, said:

Is this a Java question? Or are you just using NetBeans as your IDE as you develop the front-end (HTML/CSS) of your site?

Yeah I wasn't sure where to post this.

I am using NetBeans as my IDE to develop CSS. Should I move this elsewhere?
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10175
  • View blog
  • Posts: 37,578
  • Joined: 27-December 08

Re: Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 01:48 PM

I'll move this to HTML/CSS.
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

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.

This post has been edited by andrewsw: 20 February 2014 - 02:42 PM

Was This Post Helpful? 0
  • +
  • -

#6 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 08-July 13

Re: Adding Background images into CSS using Netbeans

Posted 20 February 2014 - 08:31 PM

That is exactly what I am doing :(. The file I attached is a photo of my desktop.
Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

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.
Was This Post Helpful? 0
  • +
  • -

#8 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 08-July 13

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.

Also make it so if I scroll down the image stays static.
Was This Post Helpful? 0
  • +
  • -

#9 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

Re: Adding Background images into CSS using Netbeans

Posted 21 February 2014 - 10:50 AM

background-size: cover; will stretch the image to fill the area.

background-position: fixed will mean that the content will scroll above the image - the image itself remains fixed/static.

You can combine some of these rules in the background shorthand rule, such as:
background: url('whatever/someimage.gif') no-repeat left top fixed;

although background-size would need to be stated separately, after this rule.

But, you've probably discovered these properties already.. :whistling:
Was This Post Helpful? 1
  • +
  • -

#10 jphoc13  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 08-July 13

Re: Adding Background images into CSS using Netbeans

Posted 21 February 2014 - 01:10 PM

You are awesome, thanks!
Was This Post Helpful? 0
  • +
  • -

#11 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,538
  • Joined: 12-December 12

Re: Adding Background images into CSS using Netbeans

Posted 21 February 2014 - 01:18 PM

No worries ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1