I have a text and an undo button in my bootstrap alert as shown here:
As you can see, the button is vertically aligned to the center, but it is not on the right. Also, the close on the right and text on the left are not vertically aligned.
I've tried using This solution, but it results in my button being under the text. Also, the height of the alert ends up matching the height of the paragraph. Here is my HTML:
<div class="container">
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="alert {{ category }}" style="vertical-align: middle;">
<button type="button" class="close" data-dismiss="alert">×</button>
<p class="pull-left d-inline">{{ message }}</p>
{% if category=='alert-success' %}
<form action="/undo" method="post" class="d-inline pull-right">
<input type="submit" value="UNDO" name="undo" class="btn btn-xs btn-danger pull-right">
</form>
{% endif %}
</div>
{% endfor %}
{% endwith %}
</div>
Note that I'm using Flask and this is Jinja syntax to get alerts. The reason I have a form in the alert is because I'm using Flask request handling to undo an action on a database.