0
2

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.

レスポンシブ対応する

Posted at

レスポンシブ対応する

思ったよりめちゃ簡単だった.

HTML

HTMLのヘッダーに以下を追記.

<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0">

width=device-width

でデバイスの幅を取得する.

CSS

CSSに以下追記.
PC向けの場合

@media screen and (min-width: 767px) { /*ウィンドウ幅が767px以上の場合に適用*/
 #hoge {
   hoge: foo;
 }
}

SP向けの場合

@media screen and (max-width: 479px) { /*ウィンドウ幅が最大479pxまでの場合に適用*/
 #hoge {
   hoge: foo;
 }
}
0
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?