Forums

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

Home Forums CSS iPhone and Mobile CSS assignment

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

    What is the best way to detect an iPhone, other mobile device, and iPad and assign different stylesheets? Is that possible?

    How would you suggest I deal with this? I’d rather not redirect to another page.

    #66168
    gno
    Member

    Media queries is one way. The principle about these is to apply different styling depending on screen size. This is the CSS-approach.

    Another possibility is to use server side detection – e.g. having a PHP script determining if its a mobile or a regular browser that visits the site, and then serve different stylesheets depending on which would fit the client the best.

    Which solution that is the best depends on how much difference there is on the page you want to serve to each type of client.

    In general, the server side solution gets better and better the more complex the difference is. Because of two things:

    1. It can seperate the sites completely, or as much as needed, to make it easier for you to work with
    2. You can avoid forcing mobile clients to download unnecessary stuff – and that will make your site load faster on mobile devices. As they have much more limited bandwidth than real browsers, loading times is much more important.

    So, if its only a difference on a few css properties, go with media queries, otherwise you will be better off with a server-side solution.

    #66169
    gno
    Member

    A link on lightweight server-side client detection using PHP: http://mobiforge.com/developing/story/lightweight-device-detection-php

    #66170
    chrisupton
    Member

    Thank you so much, gno. I’m reading about Media Queries now. This is exactly what I was hoping for. There are minor differences in each of the pages, so mq’s seem like they’ll be perfect for me here. I will read the link on client detection too.

    #66151
    gno
    Member

    Sometimes, depending on the nature of your website, it will be worth considering if your mobile visitors need to get all the content.

    Mobile visitors, in general, are not going in depth with your content. They just want the facts, quick, and are not interested in facebook-like-buttons or other stuff which are not crucial for the content to make sense.

    But if you choose to serve different content to mobile browsers, you should always provide a way to go to the regular website to users surfing the mobile version.

    No problem Chris :-)

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