Forums

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

Home Forums CSS What is wrong with this CSS Media Query?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #33110
    BoringCode
    Member

    Hi guys!

    I’m working on making a site more responsive on smaller screens (such as the iPhone).

    When I attempt to use a CSS Media Query like this one:

    /*iPhone size*/
    @media all and (max-width: 320px) and (min-height: 480px) {
    /*style goes here*/
    }

    It won’t work.

    Weirdly enough if I adjust the sizing to this:

    @media all and (max-width: 480px) and (min-width: 360px) {
    /*style goes here*/
    }

    (obviously that is not the size of anything, but it works oddly enough)

    It will work and it will apply the style to the proper elements.

    Any ideas? Is this because I’m testing in a desktop browser? Would it be different if tested it in a actual smart phone browser (obviously I’m resizing the browser to the correct size that I’m targeting).

    Any help would be appreciated.

    #74202
    bi5on
    Participant

    (max-width: 320px) and (min-height: 480px) is fine, but you might want to consider another style for users who rotate the iphone for browsing, width would then be 480px !

    :-)

    #79770
    bi5on
    Participant

    not sure if it’s important to be honest, but i am using max-device-width rather than just max-width.

    #73017
    bi5on
    Participant

    very true.

    thanks

    #82590
    grandadevans
    Member

    Hi Boringcode,

    I don’t have a tablet or decent smartphone so I was looking around a few days ago and I found this program (free) for windows
    http://www.code.google.com/p/ibbdemo2/
    It simulates the browser in iPhone and iPad in both portrait and landscape. Been using it a few days now and it is working brilliantly.
    Good luck

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