У меня проблемы с тем, чтобы мое мобильное веб-приложение правильно отображалось на моем iPhone 4. Согласно Википедии, iPhone 4 имеет 960 пикселей в ширину и 680 точек в высоту, а другие iPhone имеют примерно 480 пикселей в ширину и 340 пикселей.
С моей текущей сборкой изображения и стили CSS выглядят очень маленькими на iPhone 4.
Вот мой код:
<!DOCTYPE html>
<html>
<head>
<title>mobile</title>
<link rel="stylesheet" type="text/css" href="iphone.css" media="only screen and (max-width: 480px)" />
<link rel='stylesheet' href='highRes.css' media='only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)' />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="explorer.css" media="all" />
<![endif]-->
</head>
<body>
<div class="nav">
<div id="threeButtons">
<div class="navButton" id="friends">
Friends
</div>
<div class="navButton" id="nearby">
Nearby
</div>
<div class="navButton" id="me">
Me
</div>
</div>
<div id="settingsButton">
</div>
</div>
</body>
</html>
А вот мой CSS:
body {
background-color: #ddd; /* Background color */
color: #222; /* Foreground color used for text */
font-family: "Lucida Grand";
font-size: 14px;
margin: 0; /* Amount of negative space around the outside of the body */
padding: 0; /* Amount of negative space around the inside of the body */
display: block;
}
div.nav {
text-shadow: 0px 1px 0px #fff;
background-image: -webkit-gradient(linear, left top, left bottom,
from(#e1f7ff), to(#a1d2ed));
height: 50px;
}
#threeButtons {
float: left;
margin-left: 20px;
margin-top: 10px;
margin-bottom: 5px;
}
div.navButton {
float: left;
height: 30px;
font-weight: bold;
text-align: center;
color: white;
text-shadow: rgba(0,0,0,0.6) 0px -1px 0px;
line-height: 28px;
border-width: 0 8px 0 8px;
-webkit-border-image: url(images/button.png) 0 8 0 8;
}
#settingsButton {
float: left;
background-image: url('images/settings.png');
height: 30px;
width: 29px;
margin: 10px 0 5px 60px;
}
У кого-нибудь есть объяснения как собрать для iphone 4?Должны ли я использовать эти параметры мультимедиа для ссылки на CSS:
<link rel="stylesheet" type="text/css" href="iphone.css" media="only screen and (max-width: 480px)" />
<link rel='stylesheet' href='highRes.css' media='only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)' />
или я должен жестко задавать ширину пикселей тела в CSS?
Я только что проверил эту статью: http://menacingcloud.com/?c=highPixelDensityDisplays
но я хочу услышать, что сделали другие люди.