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
    New Coder
    Join Date
    Jan 2014
    Posts
    13
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Iphone background won't stay fixed HELP!

    Hello, I'm currently creating my first website, I have a big problem that i'm not sure how to solve..

    I have a great background that is set on fixed

    Code:
    background-image: url("http://farm4.staticflickr.com/3813/10788243594_287c438043_o.jpg");
    	background-repeat:no-repeat;
    	background-attachment:fixed;
    	background-size:100%;
    On the computer, It works fine! But.... When I visit my website on my Iphone, it will not stay fixed, It will just show the image and then go on with white background til the site ends. I know that the picture isn't so big that it can cover the iphone screen and that's why it won't work but maybe you could like make it repeat on iphone instead of being fixed and keep it fixed on the computer, is that possible? Giving the background 2 different properties showing up different on different devices?
    Last edited by vinyl-junkie; 01-20-2014 at 01:35 AM. Reason: Corrected code tags

  • #2
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    354
    Thanks
    9
    Thanked 52 Times in 51 Posts
    Perhaps you need the
    Code:
    background-size: cover;
    It's however is a CSS3, so it may not work on older browsers.

    Ref: https://developer.mozilla.org/en-US/...ackground-size

  • #3
    New Coder
    Join Date
    Jan 2014
    Posts
    13
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Well, I figured that if I changed the "Background-repeat:no-repeat;" To "background-repeat:repeat;" and left everything else as it is, it would automaticly repeat whenever the browser is longer than the background image and stay fixed if the image fits?

    All that matters is that it works fine!

    new code

    Code:
    background-image: url("http://farm4.staticflickr.com/3813/10788243594_287c438043_o.jpg");
    	background-repeat:repeat;
    	background-attachment:fixed;
    	background-size:100%;
    Last edited by VIPStephan; 01-20-2014 at 03:00 PM. Reason: fixed code BB tags


  •  

    LinkBacks (?)


    Posting Permissions

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