アラート:alert

アラートの背景色:alert-*



  <div class="alert alert-primary" role="alert">alert-primary</div>
  <div class="alert alert-secondary" role="alert">alert-secondary</div>
  <div class="alert alert-success" role="alert">alert-success</div>
  <div class="alert alert-danger" role="alert">alert-danger</div>
  <div class="alert alert-warning" role="alert">alert-warning</div>
  <div class="alert alert-info" role="alert">alert-info</div>
  <div class="alert alert-light" role="alert">alert-light</div>
  <div class="alert alert-dark" role="alert">alert-dark</div>

js アラートを閉じるボタンで消す:alert-bs-dismissible



  <!-- btn-closeで×マーク background: svg -->
  <div class="alert alert-warning alert-dismissible fade show" role="alert">
    右側の「×」マークをクリックするとアラートが閉じます
    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
    </button>
  </div>

アラート内にコンテンツを追加する:alert



  <div class="alert alert-success" role="alert">
    <h4 class="alert-heading">アラートのタイトル</h4>
    <p>アラートの内容</p>
    <p class="mb-0"><a href="#" class="alert-link">詳細内容へ</a></p>
    <p class="mb-0"><a href="#">問い合わせ</a></p>
  </div>
  

js アラートを閉じるボタンでしか消えないモーダル:data-bs-backdrop



  <button type="button" class="btn btn-primary" data-bs-toggle="modal"
      data-bs-target="#staticBackdropLive">×でしか閉じないモーダル</button>
  
      <div class="modal fade" id="staticBackdropLive" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
    aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="staticBackdropLiveLabel">Modal title</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <p>I will not close if you click outside me. Don't even try to press escape key.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
          <button type="button" class="btn btn-primary">Understood</button>
        </div>
      </div>
    </div>
  </div>