0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PCとスマホ(縦向き)とスマホ(横向き)でレイアウト変える

Posted at

PCブラウザで見る場合と、スマホで見る場合(縦横の判別)でレイアウトを変えようと試行錯誤(ググった)結果です
※javascriptが苦手なのでCSSのメディアクエリでやれました。
htmlとかあんまり得意でないので的外れ感(CSS全部中に書いてしまったり、、)あるかもしれません。。。

スマホ横向き・PCだとコンテンツ横並び、スマホ縦向きだと縦並びにしています

test.html
<html>
<head>
 <meta name=viewpoint content="width=device-width,height=device-hight,user-scalable=no,inital-scale=1,maximam-scale=1">
 <style>
  @media screen and (max-width:750px) , (orientation:portrait){
<!--こちらにスマホ縦向き用のCSSを書きます -->
   body{
       -webkit-text-size-adjust:100%;
   }
   .outside{
     display:block;
     width:100%;
     height:100%;
   }
   .outside .inside{
     display:block;
     width:100%;
     hight:50%;
     padding-right:0;
     padding-left:0;
     overflow:hidden;
   }
}
  @media screen and (min-width:900px) , (orientation:landscape){
<!--こちらにスマホ横向きPC用のCSSを書きます -->
   body{
       -webkit-text-size-adjust:100%;
   }
   .outside{
     display:table;
     width:100%;
     height:100%;
   }
   .outside .inside{
     display:table-cell;
     vertical-align:middle;
     width:50%;
     hight:100%;
     padding-right:0;
     padding-left:0;
     overflow:hidden;
   }

 }
 </style>
</head>
<body>
 <div class=outside>
 <div class=inside><iframe src="****1" scrolling=no frameborder="0" width=100% height=100%></iframe></div>
 <div class=inside><iframe src="****2" scrolling=no frameborder="0" width=100% height=100%></iframe></div>
 </div>
</body>
</html>

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?