Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Senior Member Andrew Yurlov's Avatar
    Join Date
    Apr 2011
    Location
    Portland, OR
    Posts
    1,306
    Member #
    27566
    Liked
    181 times
    What I mean by the title is how can I keep a certain div I that place no matter what. Whenever I do the Ctrl + mouse scroll to make the page bigger or smaller the dive moves around. Im trying to make the div that containes text stay in the same position.
    Artificial intelligence is nothing compared to natural stupidity -Someone

    Design is a funny word. Some people think design means how it looks.
    But of course, if you dig deeper, itís really how it works.
    -Steve Jobs



  2.  

  3. #2
    Senior Member Blackhawk095's Avatar
    Join Date
    May 2011
    Location
    Kentucky (USA)
    Posts
    384
    Member #
    27969
    Liked
    45 times
    I had that trouble about a week and a half ago. I'm going to assume that your page has been created in percentages (that's the only reason the I can think of that would create that issue).

    To fix this, you need to set your wrapper or "main container" size in pixels rather than percentages. If you set them in percentages,when you scroll in/out, your div will move to always try to match the percentage that you gave it, but when you set your div size in pixels, the page will remain at its constant size.

    This way, when you press Ctrl + mouse scroll, your page will simply zoom in and out instead of move around.

    As long as the wrapper is created with pixels, the rest of the page will be able to use percentages because they would be measured in relation to your wrapper.
    [COLOR=rgb(0, 51, 102)]Student Web Designer[/COLOR]
    [COLOR=rgb(0, 51, 102)]If you thought something I said was helpful. LIKE IT![/COLOR]

  4. #3
    Senior Member Andrew Yurlov's Avatar
    Join Date
    Apr 2011
    Location
    Portland, OR
    Posts
    1,306
    Member #
    27566
    Liked
    181 times
    Quote Originally Posted by Blackhawk095, post: 207760
    I had that trouble about a week and a half ago. I'm going to assume that your page has been created in percentages (that's the only reason the I can think of that would create that issue).

    To fix this, you need to set your wrapper or "main container" size in pixels rather than percentages. If you set them in percentages,when you scroll in/out, your div will move to always try to match the percentage that you gave it, but when you set your div size in pixels, the page will remain at its constant size.

    This way, when you press Ctrl + mouse scroll, your page will simply zoom in and out instead of move around.

    As long as the wrapper is created with pixels, the rest of the page will be able to use percentages because they would be measured in relation to your wrapper.
    :/ my whole site is created in pixels.
    example: andreyy.ddsites.net/FINAL PROJECT/index.php
    Artificial intelligence is nothing compared to natural stupidity -Someone

    Design is a funny word. Some people think design means how it looks.
    But of course, if you dig deeper, itís really how it works.
    -Steve Jobs



  5. #4
    Senior Member Blackhawk095's Avatar
    Join Date
    May 2011
    Location
    Kentucky (USA)
    Posts
    384
    Member #
    27969
    Liked
    45 times
    It may be caused by the positioning of the divs that are moving around. They are set as "position; absolute" That will keep them in that area no matter what. Try changing it to "position: relative;" and then specifying its position from there using the (top, bottom, left, and right) variables.

    I'm still working on CSS myself, so there is no guarantee that this will work.
    [COLOR=rgb(0, 51, 102)]Student Web Designer[/COLOR]
    [COLOR=rgb(0, 51, 102)]If you thought something I said was helpful. LIKE IT![/COLOR]

  6. #5
    Senior Member Andrew Yurlov's Avatar
    Join Date
    Apr 2011
    Location
    Portland, OR
    Posts
    1,306
    Member #
    27566
    Liked
    181 times
    Quote Originally Posted by Blackhawk095, post: 207767
    It may be caused by the positioning of the divs that are moving around. They are set as "position; absolute" That will keep them in that area no matter what. Try changing it to "position: relative;" and then specifying its position from there using the (top, bottom, left, and right) variables.

    I'm still working on CSS myself, so there is no guarantee that this will work.
    Well I do have the position: absolute;
    When you say top, bottom, left, right variables do you mean for example margin-left: 10px;?
    Artificial intelligence is nothing compared to natural stupidity -Someone

    Design is a funny word. Some people think design means how it looks.
    But of course, if you dig deeper, itís really how it works.
    -Steve Jobs



  7. #6
    Senior Member Andrew Yurlov's Avatar
    Join Date
    Apr 2011
    Location
    Portland, OR
    Posts
    1,306
    Member #
    27566
    Liked
    181 times
    Ok! I finally fixed it. I don't really know what did it but luckily its fixed.
    Thanks for the help.
    Artificial intelligence is nothing compared to natural stupidity -Someone

    Design is a funny word. Some people think design means how it looks.
    But of course, if you dig deeper, itís really how it works.
    -Steve Jobs



  8. #7
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    Quote Originally Posted by Andrew Yurlov, post: 207772
    Ok! I finally fixed it. I don't really know what did it but luckily its fixed.
    Thanks for the help.
    Just for future reference, he meant the relative position:
    #div{
    position: relative;
    top: 100px;
    left: 150px
    }
    That sets the div 100 px from the top, and 150px from the left, and it will always stay there.
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:59 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com