Bootstrap 3
You can create or just override default bootstrap modal-lgby doing below:
.modal-lg {
max-width: 80%;
}
If not working just add !important so it would look like below
.modal-lg {
max-width: 80% !important;
}
Now call the modal-lg.
<div class="modal-dialog modal-lg" role="document">
<!-- some modal content --->
</div
Answer from claudios on Stack OverflowFor Bootstrap 4 refer to @kitsu.eb answer. Also note that using bootstrap 4 utilities might break the responsiveness.
Bootstrap 3
You can create or just override default bootstrap modal-lgby doing below:
.modal-lg {
max-width: 80%;
}
If not working just add !important so it would look like below
.modal-lg {
max-width: 80% !important;
}
Now call the modal-lg.
<div class="modal-dialog modal-lg" role="document">
<!-- some modal content --->
</div
For Bootstrap 4 refer to @kitsu.eb answer. Also note that using bootstrap 4 utilities might break the responsiveness.
Bootstrap 4 includes sizing utilities. You can change the size to 25/50/75/100% of the page width (I wish there were even more increments).
To use these we will replace the modal-lg class. Both the default width and modal-lg use css max-width to control the modal's width, so first add the mw-100 class to effectively disable max-width. Then just add the width class you want, e.g. w-75.
Note that you should place the mw-100 and w-75 classes in the div with the modal-dialog class, not the modal div e.g.,
<div class='modal-dialog mw-100 w-75'>
...
</div>
Also, we can even use the well known container class (instead of specifying the size), like:
<div class="modal-dialog mw-100">
<div class="modal-content container">
<div class="modal-body">
...
</div>
</div>
</div>
Always have handy the un-minified CSS for bootstrap so you can see what styles they have on their components, then create a CSS file AFTER it, if you don't use LESS and over-write their mixins or whatever
This is the default modal css for 768px and up:
@media (min-width: 768px) {
.modal-dialog {
width: 600px;
margin: 30px auto;
}
...
}
They have a class modal-lg for larger widths
@media (min-width: 992px) {
.modal-lg {
width: 900px;
}
}
If you need something twice the 600px size, and something fluid, do something like this in your CSS after the Bootstrap css and assign that class to the modal-dialog.
@media (min-width: 768px) {
.modal-xl {
width: 90%;
max-width:1200px;
}
}
HTML
<div class="modal-dialog modal-xl">
Demo: http://jsbin.com/yefas/1
If you need this solution for only few types of modals just use
style="width:90%" attribute.
example:
div class="modal-dialog modal-lg" style="width:90%"
note: this will change only this particular modal
In your code, for the modal-dialog div, add another class, modal-lg:
<div class="modal-dialog modal-lg">
Or if you wanna centre your modal dialog, use:
.modal-ku {
width: 750px;
margin: auto;
}
The easiest way can be inline style on modal-dialog div :
<div class="modal" id="myModal">
<div class="modal-dialog" style="width:1250px;">
<div class="modal-content">
...
</div>
</div>
</div>