WEB制作(html・css(スタイルシート))に関する各種メモ書き

スマホサイト制作時に設定しておくと良いhtml, css, JavaScript 項目

スマホサイト制作時に設定しておくと良いhtml, css,js項目

1. リンクを押した時に押した領域に色をつける

a{
	-webkit-tap-highlight-color: rgba(200,200,200,0.2);	
}

2. 画像がはみ出すのを防ぐ

img{
	max-width: 100%;
	height: auto;
}

3. ボーダーを追加した時に width, height が増えるのを防ぐ

*{
	box-sizing: border-box;
}

4. スマホで見た時に横に移動(左右にグラグラ)するのを防ぐ

<body>
 <div class="wrapper">
  ここに記述していきます。
  </div>
</body>
.wrapper{
	overflow: hidden;
}

5. フォーム入力時に画面がズームするのを防ぐ

  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

6. スマホでダブルタップしたときに拡大しないようにするCSS

html {
  touch-action: manipulation;
}

PWA対応 1. ホーム画面用のアイコンを追加する

192px x 192px のアイコンを作成し、以下のタグで指定します。

<link rel="apple-touch-icon" href="/touch-icon.png">

PWA対応 2. 起動までに表示する画像 Sprach Screen を追加する

512px x 512px のアイコン(splash-screen.png)を作成し以下の記述を追加します。

androidの場合 少なくとも以下の3つを manifest.json に 記述します

manifest.json

{
  "name": "my app",
  "background_color": "#000",
  "icons": "/splash-screen.png"
}

manifest.jsonicons の記述方法. https://developer.mozilla.org/ja/docs/Web/Manifest/icons

iphoneの場合

こちらのサイトから作成します https://progressier.com/pwa-icons-and-ios-splash-screen-generator

関連エントリー

No.1001
02/01 11:02

edit

携帯スマホサイト
css