I made a modal with Bootstrap and everything went exactly as I wanted, the only problem is that it appears right below the button that is supposed to make the modal appear, why does this happen? How can I solve it? Here I leave my code and an image of what is happening.
<p>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#nombralo">Nombra esta foto</button>
<div class="modal-fade" tabindex="-1" role="dialog" id="nombralo">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Dale nombre a esta foto</h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="message-text" class="control-label">Nombra la foto:</label>
<input type="text" class="form-control" id="message-text">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<button type="button" class="btn btn-primary">Aceptar</button>
</div>
</div>
</div>
</div>
<h1></h1>
</p>
the modal looks like this because you have declared the modal wrong.
I explain:
modal-fade
whereby the modal is made visible as if it were a "static" div and not "invisible".modal fade
y should no longer be displayed below the button.I hope this fixes your problem :D
The problem is that if you click on the OK button it doesn't exit the modal