Forum Moderators: not2easy

Message Too Old, No Replies

css image

         

peterx

3:48 pm on May 1, 2005 (gmt 0)

10+ Year Member



Hi!
I have a problem whit this code.
myImage1 and myImage2 classes don't work.
I don't know what the problem is.
-----B.css-------

html,
body {
background-color: yellow;
}
.layer1 {

position: absolute;
left: 40px; top: 80px;
width: 100px;height: 400px;
padding: 1em;
background-color:red;
}
.myImage1 {

position: absolute;
left: 200px; top: 100px;
width: 400px;
height: 300px;
background-image: url(images/home1.jpg);
background-repeat: no-repeat;

}
.myImage2 {

position: absolute;
left: 40px; top: 150px;
width: 100px;
height: 50px;
background-image: url(images/home2.jpg);
background-repeat: no-repeat;

}

-----A.htm-------

<html>
<head>
<link rel="stylesheet" type="text/css" href="B.css" />
</head>

<body>
<div class="layer1">DDDD</div>
<div class="myImage1"></div>
<div class="myImage2">GGGG</div>
</body>
</html>

Stratus42

7:03 pm on May 1, 2005 (gmt 0)

10+ Year Member



Hi peter!

in what way don't they work? do they not align properly? do they appear elsewhere? or do the background images not appear at all?

If this is the case, I suspect your problem is in Paths.. am I correct that your css file is in a separate folder apart from your root?

if so.. try throwing some dots and a slash into your path like this:


background-image: url(../images/home1.jpg);

or this:

background-image: url(/images/home1.jpg);

or even this:


background-image: url(./images/home1.jpg);

hope this helps

:-)

s42

peterx

8:39 pm on May 1, 2005 (gmt 0)

10+ Year Member



Hi Stratus42!
you are right.
The problem was just with PATH.
The program is working now.
Thank you very much.
peter