Bootstrap 5 align center sample code

2022/06/16 13:44

Below shows a code sample that aligns a button center.

<div class="d-flex justify-content-center">
    <button type="submit" class="btn btn-default btn-block my-3"
            style="background: #f3d023;width: 30%;">
    <span class="glyphicon glyphicon-search">
        <span class="sr-only"><?php echo __('Search', 'mobilegogo'); ?></span>

Please note that you must wrap the button in a <div>tag with a class “d-flex justify-content-center”. Or it will not work.

I hope it will help you.

Leave a Reply

Back to top