Reputation: 3378
No matter what I try, the modal aligns halfway off the top of the page. I am trying to open a modal from a button that's inside a table def. It's the only modal on the page.
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="##myModal">Click Here to Preview the Job Ad</button>
<div id="myModal" class="modal fade">
<div class="modal-dialog vertical-align-center">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Confirmation</h4>
</div>
<div class="modal-body">
<p>Do you want to save changes you made to document before closing?</p>
<p class="text-warning"><small>If you don't save, your changes will be lost.</small></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>
</td>
</tr>
Upvotes: 0
Views: 128
Reputation: 1036
That's the default position of the Modals in bootstrap. However, you can change the position through CSS
Just add the following to your style for modal-dialog
style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);"
Here's the bootply: http://www.bootply.com/PZ3TA6qZNc
Without transform
, the positioning would appear something like this:
Upvotes: 1