Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Creating and Using Bootstrap Modals | Advanced Concepts
/
Bootstrap Foundations

bookCreating and Using Bootstrap Modals

メニューを表示するにはスワイプしてください

The Modal component of Bootstrap is a helpful tool for showcasing interactive content like login forms, image galleries, or alerts. Modals are essentially dialog boxes that pop up over the main content and require user interaction to close. They can be activated using different events such as button clicks, links, or JavaScript functions.

Key Features

Bootstrap modals offer customizable sizes, animations, backdrops, and positioning. They support various types of content and can be triggered by different events. They are also accessible to all users and can be further enhanced by adding ARIA attributes and focus management.

Usage Classes

  • modal: Base class for creating a modal dialog;
  • modal-dialog: Container for the modal content;
  • modal-content: Wrapper for the modal header, body, and footer;
  • modal-header: Container for the modal title and optional close button;
  • modal-title: Styles the title of the modal;
  • modal-body: Container for the main content of the modal;
  • modal-footer: Container for buttons or additional content in the modal footer;
  • fade: Applies a fade-in animation to the modal for smooth transitions;
  • modal-dialog-centered: Centers the modal vertically within the viewport;
  • modal-static: Prevents the modal from being dismissed by clicking outside or pressing the Escape key.

Example 1: Basic Modal

index.html

index.html

copy

Example 2: Animated Modal

index.html

index.html

copy

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 4.  4

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 4.  4
some-alt