Candace Farley
To align the button to the right of the card body, you can use the Bootstrap utility classes for alignment. Specifically, the d-flex and justify-content-end classes will align the buttons to the right.
Here's how you can modify your code:
<div class="card mb-3">
<div class="card-body d-flex justify-content-end">
<button type="submit" class="btn btn-primary me-2">
<i class="fas {{ $post ? 'fa-save' : 'fa-plus' }}"></i>
{{ $post ? 'Update' : 'Create' }} Service
</button>
<a href="{{ route('admin.posts.index') }}" class="btn btn-secondary">
<i class="fas fa-times"></i> Cancel
</a>
</div>
</div>
Explanation:
-
d-flex: This class makes the container (.card-body) a flex container. -
justify-content-end: This class aligns the content (buttons) to the end (right) of the flex container.
With these classes, both the Submit and Cancel buttons will be aligned to the right side of the .card-body.
Additional Notes:
-
me-2: This class is for spacing between the buttons. It's shorthand formargin-end. You can adjust the number (me-2,me-3, etc.) to control the space between the buttons.
Let me know if you need any further adjustments!