← Back to Bootstrap Course | Chapter 8: Components — Modals & Offcanvas | Lesson 2 of 8

Modal के Sizes

Modal size classes dialogs को small, large, या extra large, या full screen बनाती हैं।

In this page:

  1. Modal Sizes
Syntax
markup
<div class="modal-dialog modal-lg">...</div>
<div class="modal-dialog modal-sm">...</div>
<div class="modal-dialog modal-fullscreen">...</div>

Modal Sizes

.modal-dialog में .modal-sm, .modal-lg, या .modal-xl add करें, या .modal-fullscreen (और .modal-fullscreen-md-down जैसे breakpoint versions) इस्तेमाल करें। .modal-dialog-centered से vertically centre करें। Default width screen size के हिसाब से adapt होती है।

Note: modal-dialog-centered dialog को vertically centre करता है।

उदाहरण: Modal sizes

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body class="p-3">
<div class="container">
  <button class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#big">Large centred modal</button>
  <div class="modal fade" id="big" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-centered">
      <div class="modal-content"><div class="modal-body">This is a <b>large</b>, vertically centred modal.</div></div>
    </div>
  </div>
</div>
</body>
</html>
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. modal-content पर size classes रखना
  2. vertical centering option भूल जाना
  3. fixed widths इस्तेमाल करना
चैप्टर सारांश
  • dialog पर modal-sm, lg, xl
  • full screen के लिए modal-fullscreen
  • modal-dialog-centered centre करता है
  • Sizes modal-dialog पर जाती हैं
🔒

Chapter Quiz — Complete all 8 topics to unlock

0/8 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.