Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS IPhone browser resolution / div problem

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #169085
    JamesBarnsley
    Participant

    Hi,

    It is my understanding that the IPhone 5 has a resolution of …

    1136px by 640px

    So I have created a html page with a “div” that has a width and height set to the same size as the resolution above however when I view it through my IPhone 5 web browser it appears smaller and only fills about 2 thirds of the height and width. Implying that the browser is larger?

    How is this possible?

    James.

    #169092
    zemaker
    Participant

    are you setting the default margins and paddings to 0? Its a good practice anyways.

    * {
    margin:0;
    padding:0;
    }
    #169098
    JamesBarnsley
    Participant

    No,

    I am just using …

    html {
    
        height: 1136px;
        width: 640px;
        border: 1px solid white;
    
    }
    
    #169100
    zemaker
    Participant

    setting the width and height to 100% will do the trick.

    * {
        margin: 0;
        padding: 0;
    }
    html {
        width: 100%;
        height: 100%;
        border: 1px solid white;
    }
    #169104
    Emil
    Participant

    Doesn’t the iPhone 5 have a viewport size of 320×568?

    #169108
    JamesBarnsley
    Participant

    Ok,

    I cannot do this with width and height of 100%. I have different stylesheets for different phone resolutions. This stylesheet I am doing now is for the IPhone 5.

    The specs say IPhone 5 has a resolution of …

    1136px by 640px

    But when using this code and viewing it in the IPhones browser …

    html {
    
        height: 1136px;
        width: 640px;
        border: 1px solid white;
    
    }
    

    The white box it produces is smaller than the viewport area. About 1 third smaller each way, width and height.

    “Doesn’t the iPhone 5 have a viewport size of 320×568? ”

    It might do, but then why is the white box smaller and not larger than that area?

    It is strange.

    James.

    #169113
    Emil
    Participant

    Yes it’s strange. Maybe there is another wider container on the page?
    Also, did you add
    <meta name=”viewport” content=”width=device-width, initial-scale=1″> ?

    #169138
    JamesBarnsley
    Participant

    Hi,

    Ok thanks for your help.

    Not sure about the browser issue, but basically I am building a PhoneGap anyway. And for some reason I had to make it …

    480px by 320px

    For the resolution to work on that.

    James.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.