Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change the default positioning of modal in bootstrap?

<div class="modal">   <div class="modal-dialog">     <div class="modal-content">        <div class="modal-header">         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>         <h4 class="modal-title">Modal title</h4>       </div>        <div class="modal-body">         <p>One fine body…</p>       </div>        <div class="modal-footer">         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>         <button type="button" class="btn btn-primary">Save changes</button>       </div>      </div>   </div> </div> 

how can I change the default modal position in bootstrap, where should I edit to change the default position.

like image 995
dpndra Avatar asked Jul 14 '14 07:07

dpndra


People also ask

How do I change the default height of a Bootstrap modal box?

modal max-height is 100vh . Then for . modal-body use calc() function to calculate desired height. In above case we want to occupy 80vh of the viewport, reduced by the size of header + footer in pixels.

How do I get Bootstrap modal by default?

Answer: Use the Bootstrap . modal('show') method modal('show') method for launching the modal window automatically when page load without clicking anything.

How do I change the default width of a Bootstrap modal box?

Change the size of the modal by adding the . modal-sm class for small modals, . modal-lg class for large modals, or . modal-xl for extra large modals.

How do I open Bootstrap modal in center of screen?

Answer: Use the CSS margin-top Property This solution will dynamically adjust the alignment of the modal and always keep it in the center of the page even if the user resizes the browser window.


1 Answers

Add the following css to your html and try changing the top, right, bottom, left values.

.modal {    position: absolute;    top: 10px;    right: 100px;    bottom: 0;    left: 0;    z-index: 10040;    overflow: auto;    overflow-y: auto; } 
like image 183
msnfreaky Avatar answered Oct 07 '22 01:10

msnfreaky