Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Does IOS7 support Media Queries

Hi,


I have developed a html5 page which i want to fit to the size of IPAD(ios7) device.

Using the safari browser when i run the URL it is not able to take the shape of device orientation.

we are using media Queries to fit the size of the device. It seems media queries does not support IOS7 ?


Pls suggest.


Thanks

vijay

Posted on Jul 7, 2014 10:07 AM

Reply
6 replies

Jul 7, 2014 10:35 AM in response to vijay.sagi

Safari in iOS 7 does support media queries just fine on both iPhone and iPad. The caveat being that the resolution on an iPad is quite large and your media queries and orientation may not be accurate to the iPad.


What do your media queries look like?


Something like this would apply to an iPad.


@media screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {

Jul 9, 2014 7:31 AM in response to vijay.sagi

Again, not sure what is is you are trying to achieve. Media Queries define CSS style sections for certain criteria only.


In the case of an iPad a Media query like this would target the iPad in Landscape mode, as well as any other device who's browser supports the media query.


@media screen and(orientation:landscape)

{

...

}

while this would target it in Portrait mode.

@media screen and(orientation:portrait)

{

...

}


its up to your CSS in those sections to adjust your website to those dimensions or present different things depending on orientation.


For instance this HTML and CSS code will show which orientation the device is in by showing and hiding a div through a media query that detects orientation.

<!DOCTYPE HTML>

<html>

<head>

<title>Mobile Device Orientation with Media Queries</title>

<style type="text/css">

div.orientl

{

background-color:#f2f2f2;

padding:10px;

font-family:Arial,"sans serif";

display:none;

}


div.orientp

{

background-color:#464646;

padding:10px;

font-family:Arial,"sans serif";

color:#ffffff;

display:none;

}



@media screen and(orientation:portrait)

{

div.orientp

{

display:block

}

div.desktop

{

display: none;

}

}


@media screen and(orientation:landscape)

{

div.orientl

{

display:block

}

div.desktop

{

display: none;

}

}


</style>

</head>

<body>

<div class="orientl">

<h1>Landscape</h1>

</div>

<div class="orientp">

<h1>Portrait</h1>

</div>

<div class="desktop">

<h1>Desktop Browser or no Orientation determined</h1>

</div>


</body>

<html>

Does IOS7 support Media Queries

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.