how can i increase bootstrap modal height
18,307
The .modal-content
block is inside the .modal-dialog
block. Hence, tell the child to be of the same height as the parent. Try:
.modal-dialog {
height: 90%; /* = 90% of the .modal-backdrop block = %90 of the screen */
}
.modal-content {
height: 100%; /* = 100% of the .modal-dialog block */
}
Check:
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.modal-tall .modal-dialog {
height: 90%;
}
.modal-tall .modal-content {
height: 100%;
}
/* fix SO stick navigation ;) */
@media (min-width: 768px) { body { padding-top: 75px; } }
<div class="container">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#modalDefault">
Default modal
</button>
<button type="button" class="btn btn-warning btn-lg" data-toggle="modal" data-target="#modalTall">
Tall modal
</button>
</div>
<div id="modalDefault" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Default modal</h4>
</div>
</div>
</div>
</div>
<div id="modalTall" class="modal modal-tall fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal has 90% height</h4>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Author by
Vzupo
I fiddle with js libraries Interested in web application development, using code to automate menial tasks, and streamline production workflows Currently digging: pupeeteer.js and some node.js
Updated on June 22, 2022Comments
-
Vzupo almost 2 years
I am simply trying to make a bootstrap modal display extremely tall on a iphone 5/6 device.
I cannot get this to work for anything. I have tried increasing the height in the modal-content, as well as in modal-dialog, but it just wont work.
Any easy solutions out there?
.modal-dialog{ height:90% !important; }
<div class="container"> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch modal </button> </div> <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">My modal</h4> </div> </div> </div> </div> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>