0

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>

<head>
<title>title here</title>
</head>

<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:

<head>
<title>title here</title>
<style>
body { background: url(assets\back.jpg) #fff center no-repeat fixed;}
</style>
</head>

I have no idea what I'm doing wrong.

Any help will be greatly appreciated

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Epi23
0

Check url of the file. Are 'assests' folder and the 'css' file same root? You can also write inline-style. Like:

<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.

0

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!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.