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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    floating div clings to side of browser/moves with browser when resizing

    http://www.octopussandwich.com/

    Code:
    .account {
    	background: #333333;
    	max-width: 230px;
    	min-width: 230px;
    	border: 6px black solid;
        border-radius: 10px;
    	float: right;
    	}
    That's my website and below it is the code for the floating div. See on my website if you restore down/resize your browser the floating div will move with it. Does anybody know how to fix it?
    Last edited by OctopusSandwich; 08-08-2011 at 05:04 PM. Reason: tweaked code a little, still doesn't work

  • #2
    Regular Coder
    Join Date
    Nov 2005
    Posts
    329
    Thanks
    3
    Thanked 19 Times in 19 Posts
    You have floated the .account div to the right in the css, and tried to centre it in the html. That might be the problem...

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Avril View Post
    You have floated the .account div to the right in the css, and tried to centre it in the html. That might be the problem...
    It didn't fix it. Thanks anyway!

  • #4
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Anybody?

  • #5
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Quote Originally Posted by OctopusSandwich View Post
    http://www.octopussandwich.com/

    Code:
    .account {
        background: #333333;
        max-width: 230px;
        min-width: 230px;
        border: 6px black solid;
        border-radius: 10px;
        float: right;
        }
    That's my website and below it is the code for the floating div. See on my website if you restore down/resize your browser the floating div will move with it. Does anybody know how to fix it?

    Why you set min and max width with same value???

    If you don't width more or less than 230px, you can simply use width:230px; property.


  • #6
    Regular Coder
    Join Date
    Nov 2005
    Posts
    329
    Thanks
    3
    Thanked 19 Times in 19 Posts
    Do you wish to centre the .account div? if so you should centre it in the window with:

    margin: 0 auto;

    Or have I missed something here?

  • #7
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,724
    Thanks
    41
    Thanked 191 Times in 190 Posts
    Quote Originally Posted by Avril View Post
    Do you wish to centre the .account div? if so you should centre it in the window with:

    margin: 0 auto;

    Or have I missed something here?
    @OP... is this what you are attempting? If not please clarify. If you need to take a screen shot and edit in paint so we can see what you are attempting

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Tags for this Thread

    Posting Permissions

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