SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Using position in a document

    I'm quite confused on how to achieve a certain flow that I am attempting. After reading the CSS Faq link at the top of this forum, I'm still confused and wondering if it is even possible. Any help would be appreciated, even if that help is to look at another link/page/post. etc.

    My question is how can I position an element relative positioned to an absolutely positioned element? Allow me to explain. Lets say I have table A that I have absolutely position at left: 10px; top: 10px;. However, I do not know how long this table is going to be. But, I want table B to come right after it, but table B is it it's own <div>, just as table A is. So, I cannot use absolute positioning for table B because I have no idea how large table A is going to be. I also cannot put table B into the same <div> as table A. Can this be done?

    Thanks in advance for any help you can provide.

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,789
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Lets say I have table A that I have absolutely position at left: 10px; top: 10px;.
    Why have you absolutely placed it at 10px,10px? If its the first element on the page then it can be margin:10px and statically positioned. It will still occupy the same space. The other tables can then just follow on underneath as required.

    Is there some reason for it to be absolutely placed?

    Once you place an absolute container then you can't expect other content to treat it as though its in the flow. You could place an absolute container at 10,10 and then place static content inside the absolute container so one table would then follow the other as long as they are both in the same absolute parent.

    You may need to clarify what you want to do exactly as I can't picture what you want

    Paul

  3. #3
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a difficult situation to explain, especially in terms I'm not 100% clear on. Absolute, relative and static positioning have always evaded my understanding.

    I have a <div> that has it's own css defined for it that places it somewhere on the page. I'm attempting to override that css so that I can place the <div> in, for examples sake, at 10,10.

    The end result I am trying to achieve is to place my <div> containing table A starting at 10,10, then having the next table, table B (which is in it's own <div>) flow after it, because table A has a height that I cannot determine.

    Does this help any?

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,789
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    I can't think of an instance why you would want to do this lol

    The answer is NO.

    You can't place an absolute element anywhere on the page and have content flow beneath it unless that content is inside the same absolute container.

    It seems to me as though you may be going at this the wrong way around. Surely you should just let your table flow in the postion you want without positioning it.

    If you want to place an element at the top of the page when it is lower down the html then the only way is to fix the height so that you can make allowances for content to flow beneath. You could fix the height of the table and use overflow:auto etc to enable the scrollbars.

    Without exactly knowing what you want I would say that you can't do it the way you are trying to do it.

    Sorry

    Paul

  5. #5
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your assistance, Paul. I believe the answer to my question is that I cannot do what I am trying. New tactics!

    Thanks again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •