I have been using some media queries for the i Pad and they were working fine until two,three day ago. But they just stop working. My i Pad is not recognizing the media queries while they are still working in Firefox native responsive design test view and other online websites to check the responsive designs.
My initiative queries are with view port in header
HTML
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2"/>
#media only screen and (min-width : 768px) and (max-width : 1024px) and (orientation : landscape) { //for landscape
#media screen and (min-width: 755px) and (max-width: 1024px) and (orientation : Portrait) //for portrait.
Then tried these ones too
#media screen and (min-device-width: 768px) and (orientation:portrait){
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
#media screen and (min-device-width: 1024px) and (orientation:landscape){
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) and (min-width : 768px) and (max-width : 1024px)
and (orientation : landscape) {
//Also in addition i tried the other view port meta tag too
like
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, maximum-scale=2"/>
But no luck
I don't know where I am doing mistake but this kind a important. Please help any kind of help will be appreciated
Try the meta content:
<meta content="True" name="HandheldFriendly">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta name="viewport" content="width=device-width">
I don't know why this was ever working. I believe the issue is because you are using screen, this media type is reserved for regular computer screens.
Here is a list of the media types:
all: All media devices
aural: Speech/Sound Synthesizers
braille: Braille tactile feedback devices
embossed: Page Braille Printers
handheld: Small/Handheld Devices (like Smart Phones) [NOTE: Android, iOS, & other smart phone browsers ignore this rule.]
print: Printers
projection: Projected Presentations (like slides)
screen: Regular Computer Screens
tty: Media that uses a fixed-pitch character grid (like teletypes &
terminals)
tv: Television-type Devices
Warmth,
Crystal Miller
Related
I've got my visitor portal setup for 3 types of devices: mobile (less than 800px width), low-res desktop and hi-res desktop, like this:
<link media="only screen and (min-width: 801px) and (max-height: 899px)" href="..." rel="stylesheet" type="text/css">
<link media="only screen and (min-width: 801px) and (min-height: 900px)" href="..." type="text/css">
<link media="only screen and (max-width: 800px)" href="..." rel="stylesheet" type="text/css">
All this works rather well but with the iPad Pro portrait, the width of the screen is less than 800px but the stylesheet that's selected is the low-res desktop. What do I need to change to make it work?
Edit (to clarify the problem)
When I do something like this
<link media="only screen and (min-width: 801px) and (max-height: 899px)" href="..." rel="stylesheet" type="text/css">
<link media="only screen and (min-width: 801px) and (min-height: 900px)" href="..." rel="stylesheet" type="text/css">
<link media ="only screen and (max-width: 800px),
only screen and (max-device-width:1024px) and (-webkit-min-device-pixel-ratio:1.1) and (orientation:portrait),
only screen and (max-device-height:1366px) and (-webkit-min-device-pixel-ratio:1.1) and (orientation:landscape)"
href="..." rel ="stylesheet" type="text/css">
The problem is that the styles get mixed-up at different resolutions. I'm looking to make it work so that only one stylesheet is active at anytime.
iPad Media Queries
iPad Media Queries (All generations - including iPad mini)
iPad in portrait & landscape
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) { /* STYLES GO HERE */}
iPad in landscape
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) { /* STYLES GO HERE */}
iPad in portrait
#media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) { /* STYLES GO HERE */ }
To know more about device media queries, please visit Stephen.io/mediaqueries
Source credits to http://stephen.io/mediaqueries/
Hope this may help you.
Thank you
So, if i were you, I will do something like this:
<!-- small devices non-retina (apple use 2x for ipads and 3x for the newest iphones) -->
<link media="only screen and (max-width: 800px)" href="..." rel="stylesheet" type="text/css">
<!-- small devices retina (apple use 2x and 3x) -->
<link
media="only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 800px),
only screen and (min--moz-device-pixel-ratio: 2) and (max-width: 800px),
only screen and (-o-min-device-pixel-ratio: 2/1) and (max-width: 800px),
only screen and (min-device-pixel-ratio: 2) and (max-width: 800px),
only screen and (min-resolution: 192dpi) and (max-width: 800px),
only screen and (min-resolution: 2dppx) and (max-width: 800px)"
href="..." rel="stylesheet" type="text/css">
<!-- bigger devices low-res -->
<link media="only screen and (min-width: 801px) and (max-height: 899px)" href="..." rel="stylesheet" type="text/css">
<!-- bigger devices higher res -->
<link media="only screen and (min-width: 801px) and (min-height: 900px)" href="..." rel="stylesheet" type="text/css">
If you see in this article of CSS Tricks: Media Queries for Standard Devices you can go very specific trying to point each devices. Or get use of some of this examples (maybe in combination with orientation: portrait)
Lastly I'll like to say that, personally, I only use the -webkit-min-device-pixel-ratio: 2 or -webkit-min-device-pixel-ratio: 3 to point to the high-res raster/bitmap images (jpg and png) I'll use.
I hope this help.
You can find more info about 2x and 3x devices and how this affects images on this article from Apple.
Other resources:
MDN Media Queries.
Already mentioned by another answer (CSS Tricks): Retina Display Media Query.
Already mentioned by myself, also CSS Tricks: Media Queries for Standard Devices
A comparative of devices and screens: A quick reference for iOS devices
More official sources:
W3C Recommendation 19 June 2012 - Media Queries - Resolution
Apple's Safari Web Content Guide - Optimizing Web Content
Android's Supporting Multiple Screens
iPad pro has a retina display, with a pixel aspect ratio of probably 2, which makes virtually 2 x 800 = 1600 pixels. That's why the selected media query is the wrong one. You'll have to deal with pixel aspect ratio too. See this : https://css-tricks.com/snippets/css/retina-display-media-query/
This Query working on all device I hope your issue is resolve.
#media only screen and (max-width:767px){
.big-dot{
width:280px; height:280px; margin:0 auto; background:red;
}
}/*===========Mobile Device=============*/
#media only screen and (min-width:768px) and (max-width:1280px){
.big-dot{
width:280px; height:280px; margin:0 auto; background:green;
}
}/*===========Tab and IPad Pro Device=============*/
#media only screen and (min-width:1280px) {
.big-dot{
width:280px; height:280px; margin:0 auto; background:cyan;
}
}/*===========Large Desktop Device=============*/
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div class="big-dot">
Time Big Dot /.....
</div>
</body>
</html>
have you included <meta name="viewport" content="width=device-width, initial-scale=1.0"> in your <head>? I find including this makes retina devices behave as expected without any extra fiddling with 2x and 3x devices mentioned by f-spin
edit: just beware, you may find this affects layout that currently works well, but overall should make media queries more predictable once you've got over that (probably quite small) hump
As per my knowledge resolution of iPad Pro is (1024x1366)px and iPad Pro9.7 is (768x1024)px. So if you want to load specific stylesheet for specific resolution, then you might be load the stylesheet of
<link media="only screen and (min-width: 768px) and (max-width: 1199px)" href="..." rel="stylesheet" type="text/css">
I think this will help you.
This Query working on all device I hope your issue is resolve.
/*---------------------------------------------------------------------
Large Desktops
-----------------------------------------------------------------------*/
#media only screen and (min-width: 992px) and (max-width: 1200px) {
}
/*---------------------------------------------------------------------
Desktops
----------------------------------------------------------------------*/
#media only screen and (min-width: 768px) and (max-width: 991px) {
}
/*---------------------------------------------------------------------
Tablets Devices
-----------------------------------------------------------------------*/
#media only screen and (min-width: 480px) and (max-width: 767px) {
}
/*----------------------------------------------------------------------
Mobile Devices
------------------------------------------------------------------------*/
#media only screen and (min-width: 360px) and (max-width: 479px) {
}
/*----------------------------------------------------------------------
Small Screen Mobile Devices
-----------------------------------------------------------------------*/
#media only screen and (min-width: 320px) and (max-width: 359px) {
}
i'm using an emulator currently at http://mobiletest.me/ but my site is all over the place. The media code i'm using is this:
#media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : portrait)
but it isn't seeming to use this media query and is using my other query for ipad with is #media (max-width:768px)
I am using this meta in my html:
<meta name="viewport" content="width=device-width, initial-scale=1">
I have the media queries in descending order 1600px 1280px 768px etc.
try to use :
#media only screen and (min-width:320px) and (max-width: 568px){}
device-width refers to the actual width of the device someone's using, not the viewport width.
In your example:
#media only screen and (min-device-width : 320px) and (max-device-width : 568px)
Could target iPhone 4's 'portrait' view (640px).
This is important because the iPhone 4 (and many other mobile devices for that matter) for example crams in 2 pixels per 'CSS' pixel. This means the device-width of the iPhone 4 is 320px / 480px, whereas the viewport width is actually 640px / 960px.
I am developing a responsive website and I'm applying the below media CSS queries:
Query1:
#media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : landscape) { /*My Styling*/}
Query2:
#Media screen and (max-width:768px) { /*My Styling*/ }
Query3:
#Media screen and (max-width:1024px) { /*My Styling*/ }
I am also doing this meta statement in the head:
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1, user-scalable=no" />
For some reason the second and the third query are being applied fine but when I test the first query (Practically targeting iPhone landscape) none of the defined styles get applied.
As you haven't specified a min-width for other queries you should organize your css like this:
query3
query2
query1
That way your last level of css will be applied correctly without getting overwritten by your other queries.
Emulation of a iphone device in landscape orentation in chrome works as intended:
http://www.bootply.com/tumubw4Ztq
#Media screen and (max-width:1024px) { body{background-color:red;}}
#Media screen and (max-width:768px) { body{background-color:yellow;}}
#media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : landscape) { body{
background-color:blue;}}
A Wordpress website (using the Genesis framework) I've designed to be responsive displays properly on an iPhone and a HTC but doesn't on Samsung Galaxy phones. (tested on Samsung Galaxy S2 and a Samsung Ace) I'm currently using the FitVids plugin to make the video embeds responsive.
Strangely, pages with no video embeds viewed on a Samsung phone displays properly, but on a page with video embeds, the page layout displayed is that for an tablet screen and not for a phone screen.
I've tried various other plugins but none of them seem to solve this problem.
It would be great if someone could offer any advice on this.
Here's My site
Here's the css stylesheet
As i have found that samsung screen is 480*800px
Please try with below CSS:
#media only screen
and (min-device-width : 480px)
and (max-device-width : 800px)
and (orientation : landscape) {
}
#media only screen
and (min-device-width : 480px)
and (max-device-width : 800px)
and (orientation : portrait) {
}
Thanks
try using this
<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport">
It is not recommended that you use #media rules, since the pixel size on a mobile device vs desktop may vary.
For instance, instead of:
#media only screen
and (min-device-width : 480px)
and (max-device-width : 800px)
and (orientation : landscape) {
}
#media only screen
and (min-device-width : 480px)
and (max-device-width : 800px)
and (orientation : portrait) {
}
Add a container that will have a margin-left of 5% and margin-right of 5%:
<body>
<div class="container">
# Your body goes here
</div>
</body>
I have found this a much more user friendly and maintained approach to responsive design than the standard #media rule.
For my site TheExpeditioner.com I have added mobile specific CSS beginning with:
#media only screen and (max-width: 767px) {
I have also included <meta name="viewport" content="width=device-width, initial-scale=1"> in the header.
However, my site will not display the mobile CSS in mobile devices. Am I missing something? Is this something to do with Wordpress and/or plugins?
Here is 1 thing that my eye caught for now
#media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : portrait) {
its at line 1499, and there is no closing bracket.