Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
One DIV on top of another?
Old 06-26-2009, 10:27 PM One DIV on top of another?
Ultra Talker

Posts: 316
Trades: 0
I have one div which has an image in. The div is the same size as the image.

I have another div I would like place on top of that div and the image. I would like it positioned in the bottom right hand corner.

Here is the CSS of the div that has the image in:
Code:
.image {
    float:right;
    border:#999999 1px solid;
    width:200px;
    height:200px;
    }
Here is the CSS of the div I would like place on top of the image in the above div:
Code:
.image-click {
    background-color:#003366;
    height:25px;
    width:25px;
    position: relative;
    left: 175px;
    top: 175px;
    }
It works ok when the first div is empty but once there is an image in the div the image is pushed out of its div (image) div gets knocked out the way.

Thanks.
Joe3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-27-2009, 07:30 AM Re: One DIV on top of another?
StylaStyla's Avatar
Mad Man

Posts: 401
Name: Styla
Location: City of London
Trades: 0
How about making the image a background image in the initial div?
__________________
Freelance Graphic Designer not for hire
StylaStyla is offline
Reply With Quote
View Public Profile Visit StylaStyla's homepage!
 
Old 06-27-2009, 10:38 AM Re: One DIV on top of another?
Ultra Talker

Posts: 316
Trades: 0
I did think of that. But I want to use the div multiple times with a different image in. Not sure of a good way to do that apart from creating loads of styles with different background images.
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 06-27-2009, 10:52 AM Re: One DIV on top of another?
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
In this case you're going to need absolute positioning for the div you want to place ABOVE the other. Set the 1st div (the bottom one) to position: relative, set the one above it to position:absolute and give it a z-index of 50 or something (you want a higher number, not "2").
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-27-2009, 02:18 PM Re: One DIV on top of another?
Ultra Talker

Posts: 316
Trades: 0
Thank you.

It worked with or without the z-index.
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 07-24-2009, 04:28 PM Re: One DIV on top of another?
Junior Talker

Posts: 1
Trades: 0
Quote:
Originally Posted by LadynRed View Post
In this case you're going to need absolute positioning for the div you want to place ABOVE the other. Set the 1st div (the bottom one) to position: relative, set the one above it to position:absolute and give it a z-index of 50 or something (you want a higher number, not "2").

Sorry to bother you again about this as the other person got it working but I just can't?

My HTML looks like this:

<div id='mainContentBackground'>
<img src="MainContentBackground.gif" height="100%" width="100%"/>
<div id='mainContent'>
<br><br><br><br><br>
</div>
</div>

And my css looks like this:

#mainContentBackground{
position:relative;
height:82%;
width:83%;
float:left;
}

#mainContent{
margin-top:20px;
margin-left:6px;
margin-right:6px;
margin-bottom:6px;

position:absolute;
z-index:50;

height;
width:99%;
background-color:#e0ecff;
}

But the mainContent div is still appearing underneath the img?????

If you could help in any way, It would be VERY VERY APPRICIATED!!!

Thank you so much in advance
IrishWMT
IrishWMT is offline
Reply With Quote
View Public Profile
 
Old 07-24-2009, 09:10 PM Re: One DIV on top of another?
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Why aren't you putting the image in as a BACKGROUND on the div ?? That is what you need to do, not put the image INSIDE the div.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to One DIV on top of another?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24968 seconds with 12 queries