メディアクエリーの書き方
[html]<a href="http://news.mynavi.jp/articles/2010/10/12/css3-media-query-template/index.html" target="_blank">参照</a>
<a href="http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries" target="_blank">元記事参照</a>
<a href="http://aqua-create.com/css/css3-media-queries-width-website/">ここ</a>も参考になります
[/html]
IE8以下は、アカンようで、
[html]
<!–[if IE]>
<link href="pc.css" rel="stylesheet" type="text/css" />
<![endif]–>
[/html]
これ要るようです。
[css]/* スマートフォン (縦向き、横向き両対応) ———– */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
}
/* スマートフォン (横向き) ———– */
@media only screen and (min-width : 321px) {
}
/* スマートフォン (縦向き) ———– */
@media only screen and (max-width : 320px) {
}
/* iPads (縦向き、横向き両対応) ———– */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
}
/* iPads (横向き) ———– */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {
}
/* iPads (縦向き) ———– */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
}
/* デスクトップとノートPC ———– */
@media only screen and (min-width : 1224px) {
}
/* 大きなディスプレイ ———– */
@media only screen and (min-width : 1824px) {
}
/* iPhone 4および解像度密度の高いデバイス ———– */
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
}
[/css]
[html]
<head>
<link rel="stylesheet" href="smartphone.css" media="only screen and (min-device-width : 320px) and (max-device-width : 480px)">
<link rel="stylesheet" href="smartphone-landscape.css" media="only screen and (min-width : 321px)">
<link rel="stylesheet" href="smartphone-portrait.css" media="only screen and (max-width : 320px)">
<link rel="stylesheet" href="ipad.css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px)">
<link rel="stylesheet" href="ipad-landscape.css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape)">
<link rel="stylesheet" href="ipad-portrait.css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait)">
<link rel="stylesheet" href="widescreen.css" media="only screen and (min-width : 1824px)"> <link rel="stylesheet" href="iphone4.css" media="only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5)">
</head></code>
[/html]
携帯用も書いときます
[html]
<link rel="stylesheet" type="text/css" href="携帯用CSS場所" media="handheld, tty" />
<link rel="stylesheet" type="text/css" href="PC用CSSファイル場所" media="screen, projection " />
[/html]
こんなこと書いた事もあった
[html]
<head>
.
.
<link rel="stylesheet" type="text/css" href="./mobile_home.css" media="handheld, tty" />
<link rel="stylesheet" type="text/css" href="./pc_home.css" media="screen, projection" />
<style type="text/css" media="handheld, tty">.for_pc{display:none;}</style>
.
.
</head>
<body>
<div class="for_mobile">うまく表示できないときは<a href="携帯用UTL/mobile/">こちら</a>へアクセスしてください</div>
<div id="contens" class="for_pc">
.
.
(内容)
.
.
</div>
[/html]