image will show in <body>, but not in CSS

Thread Solved

Join Date: Jun 2009
Posts: 16
Reputation: Epi23 is an unknown quantity at this point 
Solved Threads: 0
Epi23's Avatar
Epi23 Epi23 is offline Offline
Newbie Poster

image will show in <body>, but not in CSS

 
0
  #1
Oct 27th, 2009
Ok, this is confusing me to no end, I am making a site and am trying to get the background image to stay in the center, not repeating. I've done this countless times by linking to an internet URL, but not from off of my own hdd.

The code I got to work is:

HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2.  
  3. <head>
  4. <title>title here</title>
  5. </head>
  6.  
  7. <body background=assets\back.jpg>

but it repeats it, I don't want it too.

but, when I use CSS, it just shows a blank page.

My CSS code (I just used it in the head tag) is:

HTML and CSS Syntax (Toggle Plain Text)
  1.  
  2. <head>
  3. <title>title here</title>
  4. <style>
  5. body { background: url(assets\back.jpg) #fff center no-repeat fixed;}
  6. </style>
  7. </head>

I have no idea what I'm doing wrong.

Any help will be greatly appreciated
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 85
Reputation: Zero13 is an unknown quantity at this point 
Solved Threads: 13
Zero13 Zero13 is offline Offline
Junior Poster in Training
 
0
  #2
Oct 27th, 2009
Check url of the file. Are 'assests' folder and the 'css' file same root? You can also write inline-style. Like:
HTML and CSS Syntax (Toggle Plain Text)
  1. <body style="background: url('assets\back.jpg') no-repeat top center;">
But external style-sheet was strongly controlled of the layout of your site with one file. The best way is placing the 'css' file and images in the same root.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 16
Reputation: Epi23 is an unknown quantity at this point 
Solved Threads: 0
Epi23's Avatar
Epi23 Epi23 is offline Offline
Newbie Poster
 
0
  #3
33 Days Ago
Yep, I got it to work now. I put it in the same root, and now it works. I wrote out the code again, and now it works. I have no idea what it was I did wrong, but nonetheless it works now. Thanks for the help!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC