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

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.

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.