Course Content
Bootstrap Essentials for Modern Websites
Bootstrap Essentials for Modern Websites
Challenge & Quiz
Task: Creating a Bootstrap Modal
Create a Bootstrap modal window component that displays product details. Follow the steps provided in the initial code to fill in the missing Bootstrap classes and complete the modal structure.
- Step 1: Create modal structure.
- Apply the
modal
class to the outermost container; - Use the
modal-dialog
class for the dialog box; - Add the
modal-content
class for the content area; - Ensure the modal is centered vertically within the viewport by applying the
modal-dialog-centered
class to themodal-dialog
container; - Use the
modal-title
class for the title element (<h5>
); - Apply the
btn-close
class to the close button within the modal header.
- Apply the
- Step 2: Add Product Details.
- Insert the product image within the modal body and ensure it scales appropriately using the
img-fluid
class; - Display the product title using an appropriate heading tag (
<h6>
) and apply themodal-title
class; - Provide a brief product description using a paragraph element (
<p>
) and apply themodal-text
class.
- Insert the product image within the modal body and ensure it scales appropriately using the
index
index
index
- Utilize Bootstrap's modal component classes to create the modal structure:
- Use
modal
class for the outermost container; - Use
modal-dialog
class for the dialog box; - Use
modal-content
class for the content area.
- Use
- Center the modal vertically within the viewport using the
modal-dialog-centered
class applied to themodal-dialog
container. - Ensure the modal title is appropriately styled by applying the
modal-title
class to the title element (<h5>
). - Utilize the
btn-close
class for the close button within the modal header to ensure consistent styling and functionality. - Customize the modal size by applying one of the size classes (
modal-lg
,modal-xl
, etc.) to themodal-dialog
container.
index
index
index
Thanks for your feedback!