Example

Toggle a working modal demo by clicking the button below. It will slide down and fade in from the top of the page.

Static backdrop

When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it.

Scrolling long content

When modals become too long for the user's viewport or device, they scroll independent of the page itself. Try the demo below to see what we mean.

Vertically centered

Add .modal-dialog-centered to .modal-dialog to vertically center the modal.

Top cover

Sizes

Modals have three optional sizes, available via modifier classes to be placed on a .modal-dialog. These sizes kick in at certain breakpoints to avoid horizontal scrollbars on narrower viewports.

Size Class Modal max-width
Small .modal-sm 400px
Default None 550px
Large .modal-lg 800px
Extra large .modal-xl 1140px

Our default modal without modifier class constitutes the “medium” size modal.