Emin Sinanyan
Emin Sinanyan

Reputation: 21

Multiple Background Images css not woking for me

I want to create multiple background images but for some reason it is not working for me. I have googled online and watched some tutorial videos on youtube. I followed the tutorial instructions step by step but i do not know why its not working for me.

I am using Dreamweaver CS6.

Here is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1
<style type="text/css">
body
{ background: url(images/navi-bg.png) repeat-x 0 85px, url(images/gplaypattern.png) repeat;

}
</style>
</head>
<body>
</body>
</html>

and here are the links to the images:

enter image description here

enter image description here

I want the first image to have backgound-repeat: repeat-x backgound-positon (x): 0 backgound-position (y)85px

the 2nd image should repeat

Upvotes: 0

Views: 1042

Answers (3)

Alex
Alex

Reputation: 88

Have look at this jsFiddle Link - http://jsfiddle.net/nFPLN/

<style type="text/css">
    body { 
        background: url('http://oi48.tinypic.com/23vyd6g.jpg'),
        url('http://oi46.tinypic.com/oucxky.jpg');
        background-repeat: repeat-x, repeat;
    }
</style>

Upvotes: 1

SaurabhLP
SaurabhLP

Reputation: 3657

Idea is this, change your code with this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <style type="text/css">
body {
    background-image: url(images/navi-bg.png), url(images/gplaypattern.png);
    background-repeat: no-repeat, no-repeat;
    background-color: transparent, transparent;
}
</style>
 </head>

 <body>
</body>
</html>

Upvotes: 1

Atif Azad
Atif Azad

Reputation: 527

here is the solution you are missing html and head tag and also forgot closing doctype

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
 <style type="text/css">
 body
 { background: url(http://i48.tinypic.com/23vyd6g.png) repeat-x 0 85px, url(http://i46.tinypic.com/oucxky.png) repeat;

 }
 </style>
 </head>

 <body>
 </body>
 </html>

Upvotes: 1

Related Questions