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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2009
    Location
    in .........
    Posts
    260
    Thanks
    183
    Thanked 0 Times in 0 Posts

    How to fix the position of the background image

    I have a problem in making the position of the background image to be fixed with the changes of the screen resolution.
    the problem happen and the the horizontal position of background image change when I open the page on another screen with another resolution.

    and this is the css code of the div :

    div#main{
    width:990px;
    margin-right:auto;
    margin-left:auto;
    padding-top:20px;
    padding-bottom:20px;
    background:#c5c5c5;
    background-image:url(images/filmobk2.jpg);
    background-position:19cm 13em;
    background-repeat: no-repeat;
    background-attachment:fixed;
    }

    I tried to make it with "em,%,px" and all of them also make it's position change.

  • #2
    New Coder
    Join Date
    Mar 2011
    Posts
    62
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Try setting the width of the main div to 97%.


    div#main{
    width:97%; <-----
    margin-right:auto;
    margin-left:auto;

    You can keep messing with that width until you get it where you want it.
    In my experience, 97% is good, try 97.5, 98, 98.5 etc.

  • Users who have thanked BoyWander for this post:

    Mido™ (04-07-2011)

  • #3
    Regular Coder
    Join Date
    Aug 2009
    Location
    in .........
    Posts
    260
    Thanks
    183
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BoyWander View Post
    Try setting the width of the main div to 97%.


    div#main{
    width:97%; <-----
    margin-right:auto;
    margin-left:auto;

    You can keep messing with that width until you get it where you want it.
    In my experience, 97% is good, try 97.5, 98, 98.5 etc.
    Thanks but it didn't fix it, the same problem happened also.


  •  

    Posting Permissions

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