2
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.

知識ゼロでもHTML.CSSでアラートとボタンを作る方法

Last updated at Posted at 2020-12-07

HTML.CSSのコピーアンドペースト手順の備忘録です。

大枠な流れ・Bootstrap使い方まとめ

  1. リンク先コピー:CSSのみ
  2. headerコピー:Components の Alerts
  3. ボタンコピー:Components の Buttons
  4. 全体の中央寄せ:Layout の container
  5. ボタン真ん中寄せ:Utilities の Flex
  6. スペースのバランスを整える:Utilities の Spacing「Exaples」

Step1 フォルダを作る

HTML.CSSを書いていくフォルダを作ります。

~$ mkdir test

Step2 "html5boilerplate"フォルダをダウンロード&コピー

  1. html5boilerplate ダウンロード
  2. ダウンロードフォルダの中へ移動
  3. html5boilerplateフォルダを開く
  4. index.htmlのみコピースクリーンショット 2020-12-07 1.31.04.png
  5. 最初に作ったtestフォルダの中に貼り付ける

Step3 HTML.CSS実行

  1. テストフォルダのindex.htmlをエディタで開く

  2. <body></body>で囲まれている中身を消す

  3. Bootstrap検索

  4. ダウンロード又は下の方にあるCSSのみと書いてある所のコードを全部コピースクリーンショット 2020-12-07 9.01.02.png

  5. <head></head>の19行目あたりに貼り付けスクリーンショット 2020-12-07 11.17.31.png

  6. index.htmlファイルを検索タブにドラック&ドロップしてタブに表示する(CSSのコードの結果が見れる)

Step4 headerをつける

  1. Bootstrapドキュメントをクリック
  2. 左側メニューのComponentsをクリック
  3. Alertsをクリックし好きなコードをコピースクリーンショット 2020-12-07 9.23.46.png
  4. index.htmlファイル<body>のなかに貼り付け

Step5 ボタンをつける

  1. Buttonsをクリック
  2. 好きなボタンコードをコピースクリーンショット 2020-12-07 9.30.32.png
  3. index.htmlファイル<body>内の<div class="alert alert-info" role="alert">A simple info alert—check it out!</div>の下あたりに貼り付け
  4. 4つ同じコードを打つスクリーンショット 2020-12-07 9.45.28.png

Step6 全体を中央に寄せる

  1. Layoutをクリックする
  2. コンテナーコピースクリーンショット 2020-12-07 9.57.11.png
  3. index.htmlファイルの<Body>タグすぐ下に貼り付けて、</div>の部分のみ</Body>のすぐ上に移動させる
例 
<body>
 <div class="container">
    <!-- Content here -->

    <div class="mt-3 alert alert-info" role="alert">
    A simple info alert—check it out!
    </div>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>

 </div>
</body>

Step7 ボタンを真ん中に寄せる

  1. UtilitiesFlexをクリック
  2. 好きなレイアウトのコードをコピースクリーンショット 2020-12-07 10.12.57.png
  3. index.htmlファイルの<Body>buttonのすぐ上に貼り付け
例
<div class="d-flex justify-content-center">
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
      <button type="button" class="ml-1 btn btn-secondary">Secondary</button>
</div>
  1. index.htmlタブをリロードして確認

Step 7 スペースのバランスを整える

  1. Spacingをクリック
  2. スクロールをし「Exaples」のml-1をコピー
  3. index.htmlファイルの<Body><button>のclass内に入れていくスクリーンショット 2020-12-07 10.33.26.png
  4. alartにも同様に入れていくスクリーンショット 2020-12-07 10.36.11.png
  5. index.htmlタブをリロードして確認(色は異なる場合があります)スクリーンショット 2020-12-07 10.38.11.png

完成です。参考になれば幸いです。

参考にした動画:【JavaScript超入門講座】わずか50分で知識ゼロから基礎をマスター!

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