Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Team

I am struggling to align my div class from left to right, i want my fa-fa search be on the left and button to the right. What i have tried is as below still not working as what i want and need some help with aligning using bootstrap div class that does this.

What I have tried:

<center>
            <center>
                <form class="md-form">
                    <div class="file-field">
                        <div class="btn btn-primary btn-sm float-left">
                            <span>Choose file</span>
                            <input type="file">
                        </div>
                        <div class="file-path-wrapper">
                            class="icon-upload">
                            <input class="file-path validate" type="text" placeholder="Upload your file">
                        </div>
                    </div>
                </form>
            </center>

        
                <div class="form-group row">
                    <div class="input-group col-md-4">
                        <input class="form-control py-2 border-right-0 border" type="search" value="search" id="example-search-input">
                        <span class="input-group-append">
                            <button class="btn btn-outline-secondary border-left-0 border" type="button">
                                ^__i class="fa fa-search">
                            </button>
                        </span>
                    </div>
                </div>
        </center>
    </div>
  
</center>
Posted
Updated 9-Sep-20 22:48pm

1 solution

There isn't a fa fa-search element in your code.

Assuming you want it to be part of the same input group as the button, you just need to add it with the correct class:
HTML
<div class="form-group row">
    <div class="input-group col-md-4">
        <div class="input-group-prepend">
            <span class="fa fa-search" aria-hidden="true"></span>
        </div>
        <input class="form-control py-2 border-right-0 border" type="search" value="search" id="example-search-input">
        <div class="input-group-append">
            <button class="btn btn-outline-secondary border-left-0 border" type="button">
                
            </button>
        </div>
    </div>
</div>
Input group · Bootstrap v4.5[^]

Also, stop using the <center> tag. It has been obsolete for over 20 years now.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900