Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1508 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

CSS Absolut position and nesting problem

Thread title: CSS Absolut position and nesting problem
Closed Thread    
    Thread tools Search this thread Display Modes  
08-04-2005, 07:59 AM
#1
UrlTrends is offline UrlTrends
UrlTrends's Avatar
Status: Junior Member
Join date: Jan 2005
Location: Sacramento, CA
Expertise:
Software:
 
Posts: 68
iTrader: 0 / 0%
 

UrlTrends is on a distinguished road

  Old  CSS Absolut position and nesting problem

Hello,

I have a page that has a centered div with the pages main content. When a user clicks on something I display a hidden div where they clicked (or atleast it is supposed to). The problem is that I am getting the X and Y coordinates from the browser and not the parent div so the place that the div shows up is way off on browsers with large screen sizes (the page is centered). It is exactly where it needs to be of the main content takes up the whole page (1024x768).

My question is, is there any way to get the x and y coordinates from the current parent div instead of the browser? Or is there any way to tell my new layer to use the body parent instead of its parent layer?

I just thought of another thing i could do but it would require reliably getting the viewable browser width. Do you know how to do this?

I forgot to mention that am am doing this with Javascript (if you werent't already able to tell)

Thanks

08-04-2005, 08:27 AM
#2
derek lapp is offline derek lapp
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
 
Posts: 2,246
iTrader: 0 / 0%
 

derek lapp is on a distinguished road

  Old

avoid absolute positioning (or positioning in general) like the plauge.

08-04-2005, 08:58 AM
#3
Julian is offline Julian
Status: Simply to simplify
Join date: Apr 2005
Location: Foxton, Manawatu, New Zealand
Expertise:
Software:
 
Posts: 5,572
iTrader: 0 / 0%
 

Julian is on a distinguished road

  Old

This should display elements relative to the parent div:

#nameofhiddendiv {
position: relative;
top: 100px;
left: 100px;
}

Then adjust the pixel values to suit. The problem with absolute values is that they throw the div element out of the normal page display. Use relative values to display elements based on the top-left values for the parent divs.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed