Categories: Development

Making Bootstrap modals wider

Bootstrap modals come in 4 sizes, You have the default, small, large and extra-large. The default size is closer to small and often at times in usage feels very restricted in its width. Considering the whole page can be used for content yet the modal pops up and uses less than 25% of the width.

This minimal sized, pop up content feels natural to be smaller than the page. That’s the distraction however occasionally more than some words and buttons need to be in a modal.

4 sizes

The small modal has a max-width of 300px, default is 500px, large is 800px and extra-large has a max-width of 1140px.

Using the default Bootstrap classes to achieve a wider modal rather than just setting the max-width in CSS means that it will be responsive at different frame sizes.

Usage

Use modal-lg beside modal-dialog for a wider modal, modal-xl for a really wide modal or modal-sm for a smaller modal.

Example:

<div class="modal-dialog modal-lg">

Or a working example at CodePen.

 

 

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago