Reputation: 57
The Bootstrap Modal has suddenly decided to fail on me.. Been searching for a solution but nothing matches my issue since I'm not using Bootbox or a beta version.
Here's what the modal looks like:
Modal code:
<div class="modal fade" id="successmodal" tabindex="-1" role="dialog" aria-labelledby="successmodalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<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="successmodalLabel">This is a title</h4>
</div>
<div class="modal-body">
This is a message
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
I show it using jquery and I'm using this CDN:
https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
this style CDN(?):
https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
Upvotes: 2
Views: 1648
Reputation: 36
The reason your title is on the right is because bootstrap adds:
.modal-header .close{
margin: -1rem -1rem -1rem auto;
}
Forcing the close button to the right and in your case the title as it is after the button
Upvotes: 0
Reputation: 1374
Did you add all your content properly?
I am able to get the bootstrap modal perfectly. Check the codepen here: https://codepen.io/immnk/pen/dmKPowCodepen
<div class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>Modal body text goes here.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
Remember to have these included:
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
Upvotes: 2
Reputation: 402
Faced same issue ! Somehow it was corrected just by interchnging the button and title positions i.e.
<h4 class="modal-title" id="successmodalLabel">This is a title</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
Upvotes: 2
Reputation: 497
This can happen due to many reasons:
Any css overrides of modal or title or close button Its can be easily solved by
<h4 class="modal-title pull-left" id="successmodalLabel">This is a title</h4>
If no then
#successmodalLabel{
display:inline;
float:left;
}
or use
#successmodalLabel{
display:inline;
width:100%;
text-align:left;
}
Upvotes: 1