How to align the two buttons that are shown below in the image?
<div class="form-group">
<label for="ExpenseDate">Expense Date:</label>
<input type="date" class="form-control" id="ExpenseDate" name="ExpenseDate" required>
</div>
<div class="form-group">
<label for="CategoryDescription">Category Description:</label>
<input type="text" class="form-control" id="CategoryDescription" name="CategoryDescription" required>
</div>
<button type="submit" class="btn btn-primary">Save Changes</button>
<a class="btn btn-danger" href="/expenses">Cancel</a>
4
Answers
There are plenty of examples here – How can I vertically center a div element for all browsers using CSS?
Enclose your buttons in a parent container and set its display property to
flex
.In the code below, I included the bootstrap package and created a flex parent container.
I Copied your example code, and it works fine to me…
Double check your scripts in bootstrap…
To align the two buttons , you can use the Bootstrap grid system and wrap the buttons in a new div element with the class of row and use col classes to specify the width of each button.