/    Sign up×
Community /Pin to ProfileBookmark

max width not working for mobile phone

I have three style sheets, one for big browsers that aren’t IE, one for IE and one that’s supoosed to work if the max-width is 480. I’ve tried combining the two not IE statements, I’ve tried putting the css for the max width only devices into the style sheet for the Not IE browsers. So far, the only time the mobile style sheet is even called is if I take out the other <![if !IE]> statement completely (and don’t combine it either). Can anyone help me with this? I’m testing it on the Safari user agent setting and also on my Android.

[code]<!–[if IE]>
<style>
@import url(‘innovative.css’);
</style>
<![endif]–>

<!–[if !IE]>–>
<link media=”only screen and (max-width: 480px)”
rel=”stylesheet” type=”text/css” href=”mobile.css”/>
<!–<![endif]–>

<![if !IE]>
<style type=”text/css”>
/*<![CDATA[*/
@import url(‘FF_innovative.css’);
/*]]>*/
</style>
<![endif]>[/code]

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@KorJul 08.2011 — 
  • 1. You should rather use a mobile detector, like:


  • http://www.hand-interactive.com/resources/detect-mobile-javascript.htm

    or even better written in PHP (it is easier to echo different CSS links)

    http://www.hand-interactive.com/resources/detect-mobile-php.htm

  • 2. Use the viewport meta:

    http://davidbcalhoun.com/2010/viewport-metatag
  • ×

    Success!

    Help @emella spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...