How to increase the width of a modal window in Bootstrap

To increase the width of a modal window in Bootstrap, you can use the .modal-dialog class and set the width property to a desired value in pixels or as a percentage of the viewport.

Here is an example of how you can increase the width of a modal window in Bootstrap:

.modal-dialog {
  width: 80%;
}

This will set the width of the modal window to 80% of the viewport. You can adjust this value to suit your needs.

Alternatively, you can also use the max-width property to set a maximum width for the modal window, which can be useful if you want to ensure that the modal window does not become too wide on larger screens.

.modal-dialog {
  max-width: 800px;
}

This will set the maximum width of the modal window to 800 pixels.

You can add these styles to your CSS file, or you can include them directly in the HTML file using a <style> tag.

It is also worth noting that Bootstrap provides several predefined sizes for modal windows, which you can use by adding the .modal-lg or .modal-sm class to the .modal-dialog element.

<div class="modal-dialog modal-lg">
  <!-- Modal content -->
</div>

This will set the modal window to a large size, while the .modal-sm class will set it to a small size.

Popular Categories


Search the website