944,157 Members | Top Members by Rank

Ad:
Oct 27th, 2009
0

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

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Epi23 is offline Offline
22 posts
since Jun 2009
Oct 27th, 2009
0
Re: image will show in <body>, but not in CSS
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.
Reputation Points: 120
Solved Threads: 134
Practically a Master Poster
Zero13 is offline Offline
620 posts
since Jan 2009
Oct 29th, 2009
0
Re: image will show in <body>, but not in CSS
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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Epi23 is offline Offline
22 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Overlap flash object in IE8 problem
Next Thread in HTML and CSS Forum Timeline: Vertical Align issue in IE7





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC