Add d-flex
& align-items-center
classes to the <label>
, at which point .ml-auto
will work:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" >
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css" rel="stylesheet">
<div class="form-group col-6 m-0">
<label class="my-1 d-flex align-items-center" for="role"><i class="fas fa-tag mr-2"></i> ROLE <span class="ml-auto"><i class="fas fa-question-circle"></i></span></label>
<select class="custom-select my-1 mr-sm-2 form-control r-0 light s-12" id="role">
<option value="1">Administrator</option>
</select>
</div>
Try and use the pull-right class
Add d-flex and align-items-center classes on label
<div class="form-group col-6 m-0">
<label class="my-1 d-flex align-items-center" for="role"><i class="fas fa-tag"></i> ROLE <span class="ml-auto"><i class="fas fa-question-circle"></i></span></label>
<select class="custom-select my-1 mr-sm-2 form-control r-0 light s-12" id="role">
<option value="1">Administrator</option>
</select>
</div>
I’m trying to do this with the icon that is inside a label element.
Photoshopped:

What I am getting:

This is the code for that section
<div class="form-group col-6 m-0">
<label class="my-1 mr-2" for="role"><i class="fas fa-tag"></i> ROLE <span class="ml-auto"><i class="fas fa-question-circle"></i></span></label>
<select class="custom-select my-1 mr-sm-2 form-control r-0 light s-12" id="role">
<option value="1">Administrator</option>
</select>
</div>
In this span
element <span class="ml-auto"><i class="fas fa-question-circle"></i></span>
I have tried:
.ml-auto
.text-right
.d-flex .justify-content-end
.float-right
.pull-right
But none of those seem to work.
How can I get the i
element to float to the right as depicted in the photoshopped image?
What you could do is on the first span element .pull-left and on the second element .pull-right and in the label class call the class .clearfix