1
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 1 year has passed since last update.

Iphone X以降のホームバー対策

Posted at

はじめに

IphoneX以降、ホームボタンがなくなり、新しくホームバーが誕生した。
それにより、ホームバーとアプリ画面が被ってしまい操作しにくいことが起きている。

S__96362498.jpg

この現象は特にPWAを使用している際に生じる。

この問題を解決するのがセーフエリアである。

セーフエリアについて

セーフエリアとは、iphoneX以降のホームバーやカメラに対応して、アプリの表示を調節してくれる考え方のことである。

safe-areas-1.png

以下の記事から画像引用
^https://webkit.org/blog/7929/designing-websites-for-iphone-x/

実装方法

実装方法はとてもシンプルで、HTMLとCSSに少し記載だけである。

まず、HTMLのmetaタグに以下のコードを記載する。

<meta name='viewport' content='initial-scale=1, viewport-fit=cover'>

・metaタグについて
・viewportについて

次にbottomの要素またはbody要素にCSSセレクタに以下のコードを記載する。

  padding-bottom: env(safe-area-inset-bottom);

完成!

S__96362503.jpg

参考にした記事

1
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
1
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?