Quantcast
Channel: How to center a modal window on a page? - Stack Overflow
Browsing latest articles
Browse All 12 View Live

Answer by Jakub for How to center a modal window on a page?

You could simply calculate top and left to center your modal:position: absolute;top: calc(50% - halfOfModalHeight);left: calc(50% - halfOfModalWidth);

View Article



Answer by Subash for How to center a modal window on a page?

given class name the whole div, which used modal.for example:<div class="modal">in your Content</div>In your Style:.modal {display: table;margin: 0 auto;}

View Article

Answer by shubham tyagi for How to center a modal window on a page?

If you have the modal content to be in the center of the modal you could use something like this. In here the top: 50% means the content's start will be 50% from top (note : here 50% is the value...

View Article

Answer by Kavindu Gayanath for How to center a modal window on a page?

If you want to show modal on the center of the window, follow below steps;.modal { text-align: center;}.modal-dialog { display: flex; align-items: center; min-height: calc(100% - 0rem); }Also, by...

View Article

Answer by Alpha for How to center a modal window on a page?

Tried almost all CSS options, but finally something worked : jQuerysetInterval(function() { if($('#myModal').is(':visible')===true) { $("body").addClass("modal-open");...

View Article


Answer by Big Zed for How to center a modal window on a page?

when showing you modal you should put display:flex instead of block like most people usualy do. then :<div class="modal" id="modal"><div class="modal-content"> What you want...

View Article

Answer by Muhammad Bilal for How to center a modal window on a page?

Set bootstrap modal center to any size of screen using css only..modal { text-align: center; padding: 0!important;}.modal:before { content: ''; display: inline-block; height: 100%; vertical-align:...

View Article

Answer by Shurvir Mori for How to center a modal window on a page?

Try This in Full Page Preview .modal { width: 100px; height: 100px; margin:0 auto; display:table; position: absolute; left: 0; right:0; top: 50%; border:1px solid; -webkit-transform:translateY(-50%);...

View Article


Answer by Rohan for How to center a modal window on a page?

.modal{position: fixed;left: 50%;}

View Article


Answer by Waqar Alamgir for How to center a modal window on a page?

With position:absolute Assuming your modal is 300x300.modal { width: 300px; height: 300px; position: absolute; left: 50%; top: 50%; margin-left: -150px; margin-top: -150px;}With display:table An...

View Article

Answer by Abdennour TOUMI for How to center a modal window on a page?

If modal container is as following : <div id="containerDiv"> <!--HTML modal --></div>Add css code#containerDiv{margin : 0 auto;}

View Article

How to center a modal window on a page?

I am trying center a modal window in the browser page. I just want to center it, so that it should be responsive for all the screens.

View Article
Browsing latest articles
Browse All 12 View Live




Latest Images