I want to give my mobile users a desktop mode, but I'm really not interested in making a non-responsive CSS version for every css file i have, so i wonder if it is possible without.
I've googled a bit, and the only suggestion I've seen is setting a custom width in the viewport meta tag. But the css media rules wont listen.
HTML
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=1000">
<!-- CSS -->
</head>
<body style="width:1000px;">
<div class="responsive">
<p>Why does the CSS media rule still take effect even though I've specified a width in the viewport meta tag?</p>
<p>I've misunderstood them i bet!</p>
<p>How can i force it to think its being viewed in another resolution?</p>
</div>
<div class="indicator"></div>
</body>
</html>
CSS
.responsive {
padding: 20px;
background: orange;
color:black;
}
@media (max-width: 500px) {
.responsive {
background: green;
color:white;
}
}
.indicator { position:fixed; top:0; right:500px; height:100%; width:1px; border-right:2px dashed red; padding:0; }
Live Example
Update
It actually does work (Just not on desktop - only on mobile). It sets the resolution of the viewport window, which i guess is equivalent of resizing the browser it self on PC.
So you basically can't use use the viewport for anything on PC, and the responsive options i'm making won't work. Would still love a workaround for this that works doesn't involve i frames.
It is not a good solution so I won't mark it as correct, but it is a solution...
Wrap the entire page in an
iframe
that haswidth:100%
andmin-width:1000px