How to configure modal width in Bootstrap? Last Updated : 06 Sep, 2021 Comments Improve Suggest changes Like Article Like Report Bootstrap Modal: It is a dialog window that opens inside the browser window on triggering certain events. It is a really convenient way to improve the website's content rendering as per the requirements. In this article, we will focus on adjusting the width/height of the modal box.Method 1: Using pre-defined Bootstrap classes Bootstrap has pre-defined classes for changing modal dimension attributes to be used with the div element containing .modal-dialog. These are listed below: Small-sized modal: .modal-smMedium-sized modal: .modal-mdLarge-sized modal: .modal-lg html <!-- Small Bootstrap Modal Example --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" /> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <script src= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"> </script> </head> <body> <div class="container-fluid"> <h2>Small Modal</h2> <p> Other classes mentioned above are also implemented in the same manner. </p> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal" > Open Small-modal </button> <!-- Modal Code --> <div class="modal fade" id="modal" role="dialog"> <div class="modal-dialog modal-sm"> <!-- .modal-sm here makes a small modal Can be replaced with '.modal-md' & '.modal-lg' --> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> × </button> <h4 class="modal-title">GeeksforGeeks</h4> </div> <div class="modal-body"> <p>GeeksforGeeks - A computer science portal for geeks</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal" > Close </button> </div> </div> </div> </div> </div> </body> </html> Output: Method 2: Using custom dimensions by tampering with default CSS attributes We can also customize the width/height of the modal by changing the CSS properties for the div containing .modal-dialog class. Below is the solution for the same. Solution: html <!-- Changing CSS properties for the div containing '.modal-dialog' class --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" /> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script> <script src= "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"> </script> <style> .custom { width: 600px; min-height: 400px; } </style> </head> <body> <div class="container-fluid"> <h2>Custom-sized Modal</h2> <p> We are changing CSS properties of div containing the '.modal-dialog' to do the same. </p> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal" > Open Custom-sized modal </button> <!-- Modal Code --> <div class="modal fade" id="modal" role="dialog"> <div class="modal-dialog"> <!-- '.custom' class added here to do the same --> <div class="modal-content custom"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> × </button> <h4 class="modal-title">GeeksforGeeks</h4> </div> <div class="modal-body"> <p>GeeksforGeeks - A computer science portal for geeks</p> </div> </div> </div> </div> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article How to configure modal width in Bootstrap? D devproductify Follow Improve Article Tags : Technical Scripter Web Technologies Bootstrap Technical Scripter 2019 Bootstrap-Misc +1 More Similar Reads How to hide Bootstrap modal with JavaScript? This article will tell us how the bootstrap executes when the .modal (modal window) gets closed. At some point of time, the modal window â whenever it gets opened (along with the class modal), it is going to get closed.As soon the modal has got finished, after being getting hidden from the user, the 2 min read How to use modal closing event in Twitter Bootstrap ? Bootstrap Modals offer a lightweight, multi-purpose JavaScript popup that's customizable and responsive. They can be used to display alert popups, videos, and images in a website. Bootstrap Modals are divided into three primary sections: header, body, and footer. Syntax: class | tabindex | role | ar 2 min read How to Create Modal using Bootstrap? Bootstrap modal box is a UI component that displays content overlaid on the main page. Create it by defining a trigger button with data attributes and structuring the modal in HTML with a unique ID, allowing customization of content and functionality.Syntax:<div class="modal"> Contents... < 4 min read How to change the Width of a Column in Bootstrap Table ? In Bootstrap, the table is an important component used for organizing and displaying data in rows and columns. Below are the approaches to change the width of a column in the Bootstrap table: Table of Content Using Bootstrap Grid ClassesUsing width AttributeUsing Bootstrap Grid ClassesIn this approa 2 min read How to create full width container in bootstrap5? Bootstrap containers are content holders that are used to align, add margins and padding to your content. Bootstrap has three different container classes, namely: .container .container-fluid .container-{breakpoint} Width of a container varies in accordance with its class. We can create a full width 1 min read Like