473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

div position problem

roula
18
Hi,

I have this code of some divs, and I am trying to put a transparent image in div #transp to cover a certain area of the parent div #main (in order to make an image map of the background image of #main)

i'm trying to position #transp to be in the location i want, but i'm not able to.

doesn't position:relative means the div position is relative to its parent?

here is the code, and you can read some comments inside the last div to clarify more...

Expand|Select|Wrap|Line Numbers
  1. <div id="main" style="width:800px;height:800px;margin:0 auto;background: url('/img/bge.jpg') center no-repeat;">
  2. <div id="dhtmlgoodies_scrolldiv" style="position:relative;top:255px;left:257px;">
  3. <div id="scrolldiv_parentContainer">
  4. <div id="scrolldiv_content">
  5. (my contents here)
  6. </div>
  7. </div>
  8. </div>
  9. <div id="transp" style="position:relative;width:257px;height:181px;top:352px;left:0px;background-color:#ff0000;">
  10. <img src="img/spacer.gif" width="257" height="181" />
  11. (in this div there is the transparent image, i'm just coloring it red now to see its position)
  12. (this div is supposed to be in position top 352 and left 0, the left is really 0 relative to the parent that has the background, but the top is more than 352, i dont know why... should i use -minus to position the div where i want?)
  13. </div>
if this is not clear i can post a link to the page.

thank you for your help.
Mar 12 '07 #1
2 4261
drhowarddrfine
7,435 Expert 4TB
doesn't position:relative means the div position is relative to its parent?
Relative to the first "positioned parent". So set the parent of that div to "position:relative" also.
Mar 12 '07 #2
roula
18
Relative to the first "positioned parent". So set the parent of that div to "position:relative" also.
thanks for the tip, i set #main to relative position, and the other divs to absolute position, it's good now
Mar 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Falc2199 | last post by:
Hi all, I am using the "Poistion" attribute to correctly align a column of images that I have on a table. The code looks like so.... <TD valign="top" class="listinglight" align="left"> <A...
5
by: CMAR | last post by:
I have been having a problem styling a page, which you can see live at my test site: Designer Page (http://home.ne.rr.com/thespar/) (Ignore the missing pictures, which have not been uploaded.)...
8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
3
by: akunamatata | last post by:
Hello everyone, I contact this discussiongroup because I encountered a little problem with XSL. Let me explain it: I have following file "position.xml": <?xml version="1.0"?>...
8
by: Edward | last post by:
I used to do this all the time in HTML-table layouting. How do I do this in CSS? -------------------------------------------------- <table width="400px"> <tr> <td bgcolor="beige">one line of...
5
by: Roderik | last post by:
Hi, My logo images are positioned some more to the right in IE6 than in FF1.5. I like them to be as shown in FF1.5. Does anyone have a clue, why they are positioned differently in IE? Problem...
2
by: petermichaux | last post by:
Hi, It seems like determining element position in a web page is a difficult task. In the position reporting source code I've looked at there are special fixes for at least some versions of...
2
by: agbee1 | last post by:
Hello: I've finally made the effort to ween myself from overly using tables and use CSS for my positioning. However, I am having a problem with my navigational menu properly aligning in Firefox,...
5
by: DL | last post by:
Hi, My research on this NG hasn't produced a satisfactory answer. Here's what I want to do: move two div (s) (each has an image tag within) to another location on the same page. // no...
12
Frinavale
by: Frinavale | last post by:
I think I'm trying to do something impossible. I have a <div> element with a overflow style set to "scroll". In other words my <div> element allows the user to scroll the content within it. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.