iPhone CSS background-image size problems

Discussion in 'Web Design and Development' started by NickFalk, Mar 11, 2011.

  1. NickFalk macrumors 6502

    NickFalk

    Joined:
    Jun 9, 2004
    #1
    Hi there. I'm finishing up my latest game Squid Drop today (hopefully). As part of the package I have a UIWebView linking to a php-document. My problem is that I seem unable to scale the background-image correctly. It's a fairly small sized jpg with the dimensions 640x960.

    In my mind this should easily scale the image to fill the display but I haven't dabbled with css for quite some time, and was never a wiz at it to begin with. Anyone?

    Code:
    <?php
    mb_internal_encoding("UTF-8");
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xml:lang="no" lang="no">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Squid Drop More</title>
    
    <style type="text/css">
      body {
        color: purple;
        background-color: #d8da3d; 
        background-image:url('moreSquidDropBackground.jpg');
        font-family:"Helvetica", Arial, sans-serif;
        background-repeat:no-repeat;
        background-attachment:fixed;
    
    
        width: 320px;
        
    }
    
    
    div{
    width: 320px;
    
    
    }
    
      </style>
    
    </head>
    
    
    
    <body>
       
                <div class="h2">
                     <h2>
    	                   Newsletter signup
    	              </h2>
    	                         
               
                   <h4>
                   Stay informed / Win future games
                   </h4>
                   
              </div>
              
        </body>
    </html>
    Direct link.
     
  2. kclimson macrumors newbie

    kclimson

    Joined:
    Aug 15, 2011
    Location:
    Canada
    #2
    Hm

    I actually don't see the problem. If you figure it out and finish the app reply with a link and I would love to do a review about it on my website. Thanks.
     
  3. manueld macrumors 6502

    Joined:
    Jun 8, 2009
    #3
    you can only scale a background image on css3 if that's what you're trying to accomplish.

    background-size: <bg-size> [ , <bg-size> ]*
    <bg-size> = [ <length> | <percentage> | auto ]{1,2} | cover | contain
     

Share This Page