Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder ajhauser's Avatar
    Join Date
    Nov 2007
    Location
    Earlville. It's where Earls come from.
    Posts
    226
    Thanks
    74
    Thanked 1 Time in 1 Post

    Absolute Positioning Q?

    I am curious about how I could absolute positioning more effectively - if I have the following setup:

    Code:
    <div id="Wrapper">
        <div id="SubmitButton">Submit</div>
    </div>
    Is there a way I can get the inner div (SubmitButton) positioned absolutely based off of the Wrapper div? Like if I want the SubmitButton div to stay 5px from the top and 5px from the right even if the width is later changed?

    Thanks, hope that makes sense.

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Code:
    #wrapper {
        position: relative;
    }
    #SubmitButton {
        position: absolute;
        top: 5px;
        right: 5px;
    }
    This is probably page 1 of any discussion of absolute positioning
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #3
    Regular Coder ajhauser's Avatar
    Join Date
    Nov 2007
    Location
    Earlville. It's where Earls come from.
    Posts
    226
    Thanks
    74
    Thanked 1 Time in 1 Post
    Thanks very much. I usually skip page 1.

  • #4
    Regular Coder ajhauser's Avatar
    Join Date
    Nov 2007
    Location
    Earlville. It's where Earls come from.
    Posts
    226
    Thanks
    74
    Thanked 1 Time in 1 Post
    Awesome thank you - very useful for divs. When I try to place a submit button within a form field using this relative / absolute style of positioning it doesn't work. Any idea why?

    Just curious.
    Thanks.

  • #5
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Show the relevant piece of HTML and CSS.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Posting Permissions

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