ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

css problem (prob quite basic)



  A4 Avant
I'm having problems getting CSS to do what I want! I'm very new to using it so please be as basic as possible if you can help.

Here's the html code:

<body>
<div id="div-1"></div>
<div id="div-1a"><img src="Images/Common/TL-Background.gif" /></div>
</body>

Here's the CSS code:

/* CSS Document */
body
{
text-align: center;
background-color: #cc0000;
}
#div-1
{
background-color: #FFFFFF;
width: 800px;
height:600px;
position: relative;
}
#div-1a
{
position:absolute;
left: 0px;
top: 0px;
width: 315px;
height: 359px;
}

Here's what I get:

wrong.jpg


Here's what I want:

right.jpg


Basically I want everything to be relative to the white box.

Cheers,

Nige.
 
  172
Firstly get rid of that position:relative/absolute b****cks.

This would probably help more:

#div-1
{
background-color: #FFFFFF;
width: 800px;
height:600px;
background-image: url('/Images/Common/TL-Background.gif');
background-repeat: no-repeat;
background-position:top left;
}

Then get rid of the img tag in the second div.
 
  306 TD Slut
<body>
<div id="div-1">
<div id="div-1a"><img src="Images/Common/TL-Background.gif" />
</div>
</div>
</body>
 
  A4 Avant
Ah, I can see what yout doing there, but what happens if I wanted that image say 100px from the left and 100px from the top of the white box. How would I do that.

Furry Cup, thats worked perfectly!:star:
 
  172
Ah, I can see what yout doing there, but what happens if I wanted that image say 100px from the left and 100px from the top of the white box. How would I do that

#div-1
{
background-color: #FFFFFF;
width: 800px;
height:600px;
background-image: url('/Images/Common/TL-Background.gif');
background-repeat: no-repeat;
background-position:100px 100px;
}
 
  A4 Avant
Thats what great about this site. Post a problem and literally 10 seconds later you have the answer!!!

Thanks both of you!!:clap:
 


Top