How to Properly Style List Item with Icon and Title - html

I have a li (list item) which contains four elements. 2 of the elements I would like to align to left and the other 2 to the right. The li is part of a page using the Bootstrap framework and FontAwesome project: http://pctechtips.org/apps/todo/
Here's the li
<li class="list-group-item d-flex justify-content-between align-items-center">
<i class="fa fa-plus-square-o" aria-hidden="true"></i> Pay Car Insurance
<i class="fa fa-pencil" aria-hidden="true"></i>
<i class="fa fa-trash-o" aria-hidden="true"></i>
</li>

The only thing you need to do in your case (to make it work with native Bootstrap 4 classes only and without any css hacking) is to add the ml-auto (margin-left:auto) class to the third element i.e. the pencil icon.
Then you just add a bit of padding to the plus and the pencil icon by adding the pr-3 (padding-right) class to both. That's it!
Here's the working code:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="container">
<div class="row">
<div class="add-item text-center col-sm-12 col-md-10 col-lg-8 mb-4">
<h1 class="heading-4">Todo List Items</h1>
<ul id="list" class="list-group mt-4 pb-4">
<li class="list-group-item d-flex justify-content-between align-items-center">
<i class="fa fa-plus-square-o pr-3" aria-hidden="true"></i>Pay Car Insurance
<i class="fa fa-pencil ml-auto pr-3" aria-hidden="true"></i>
<i class="fa fa-trash-o" aria-hidden="true"></i>
</li>
</ul>
</div>
</div>
</div>
And if you want to turn those icons into links, you'll need to add the ml-auto class to the anchor like so:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="container">
<div class="row">
<div class="add-item text-center col-sm-12 col-md-10 col-lg-8 mb-4">
<h1 class="heading-4">Todo List Items</h1>
<ul id="list" class="list-group mt-4 pb-4">
<li class="list-group-item d-flex justify-content-between align-items-center">
<i class="fa fa-plus-square-o pr-3" aria-hidden="true"></i>Pay Car Insurance
<i class="fa fa-pencil" aria-hidden="true"></i>
<i class="fa fa-trash-o" aria-hidden="true"></i>
</li>
</ul>
</div>
</div>
</div>

<li class="list-group-item justify-content-between align-items-center">
<i class="fa fa-plus-square-o left" aria-hidden="true"></i>
<span class="left marg_left">Pay Car Insurance </span>
<i class="fa fa-pencil right marg_left" aria-hidden="true"></i>
<i class="fa fa-trash-o right " aria-hidden="true"></i>
</li>
in css ::
.marg_left {
line-height: 16px;
margin-left: 12px;
}
.left {
float: left;
}
.right {
float: left;
}
.marg_right{
margin-right:12px;
}

you can try add class="pull-right" or class="pull-left"

Related

unable to move text up to match boxicon bootstrap

I have the code below:
<div class="vertical-nav" id="sidebar">
<div class=" px-3 mb-4">
<div class="media d-flex">
<div class="media-body">
</div>
</div>
</div>
<ul class="nav flex-column align-items-start mb-0">
<li class="nav-item">
<a href="#" class="nav-link text-white font-italic">
<i class="navbar-icon">
<box-icon name='upload' color='#ffffff' size="md"></box-icon>
</i>
<i class="fa fa-th-large text-primary fa-fw"></i>
<span class="navbar-text" >upload</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link text-white font-italic">
<i class="navbar-icon">
<box-icon name='file-blank' color='#ffffff' size="md"></box-icon>
</i>
<i class="fa fa-th-large text-primary fa-fw"></i>
<span class="navbar-text">manage</span>
</a>
</li>
Ignore the unclosed divs just a code sample. The code works fine in theory but I am unable to get the text for each navbar item aligned with the icon. I tried using margin-bottom on navbar-text but it did not have any effect (neither did padding). I tried moving the icon down with margin-top and that had no effect.
Any ideas?
You need to use Flex on the a item inside the li item. For example:
#import 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css';
li a{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: flex-start;
align-items: center;
}
.text-primary {
margin-right:10px;
font-size:50px;
}
<div class="vertical-nav" id="sidebar">
<div class=" px-3 mb-4">
<div class="media d-flex">
<div class="media-body">
</div>
</div>
</div>
<ul class="nav flex-column align-items-start mb-0">
<li class="nav-item">
<a href="#" class="nav-link text-white font-italic">
<i class="navbar-icon">
<box-icon name='upload' color='#ffffff' size="md"></box-icon>
</i>
<i class="fa fa-th-large text-primary fa-fw"></i>
<span class="navbar-text" >upload</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link text-white font-italic">
<i class="navbar-icon">
<box-icon name='file-blank' color='#ffffff' size="md"></box-icon>
</i>
<i class="fa fa-th-large text-primary fa-fw"></i>
<span class="navbar-text">manage</span>
</a>
</li>
</ul>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=
, initial-scale=1.0"
/>
<title>Document</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<style>
.navbar ul {
display: flex;
flex-direction: column;
}
.navbar ul li {
list-style: none;
margin-bottom: 2rem;
cursor: pointer;
}
</style>
<header>
<nav class="navbar">
<ul>
<li><i class="fa fa-home"></i>Home</li>
<li><i class="fa fa-search"></i>Search</li>
<li><i class="fa fa-globe"></i>menu</li>
<li><i class="fa fa-envelope"></i>message</li>
<li><i class="fa fa-sign-out"></i>logout</li>
</ul>
</nav>
</header>
</body>
</html>

I want to make vertical menu like this (See image for reference

I want to create a vertical drop-down menu. I'm using the list group and list group item class from Bootstrap. Anyone can help me, how can I open the submenu by clicking an item and it should be open in the same div which has a black border. Someone can help me how can I do it?
My menu
I want this menu
Here is my HTML and CSS code.
HTML
import React, { Component } from 'react';
function PostAdForm() {
return (
<div className="container postAd-container text-center">
<h6 className="text-left p-3">CHOOSE A CATEGORY</h6>
<ul className="list-group w-50">
<li className="list-group-item d-flex justify-content-between align-items-center">
Mobiles
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Vehciles
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Property for Sale
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Property for Rent
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Electronics & Home Appliances
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Bikes
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Business, Industrial & Agriculture
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Services
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Jobs
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Animals
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Furniture & Home Decor
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Fashion & Beauty
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Books, Sports & Hobbies
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
<li className="list-group-item d-flex justify-content-between align-items-center">
Kids
<span className="badge badge-pill">
<i class="fas fa-chevron-right"></i>
</span> </li>
</ul>
</div>
);
}
export default PostAdForm;
CSS
.postAd-container {
padding: 0 !important;
border: 1px solid #6c757d;
width: 70% !important;
}
.list-group {}
.list-group-item {
color: #6c757d !important;
font-weight: 600;
cursor: pointer;
}
.list-group .list-group-item:hover {
background-color: rgba(0,47,52,.2) !important;
color: #000 !important;
}
.fa-chevron-right {
font-size: 20px !important;
color: #6c757d !important;
}
Two things to consider.
#1 Use FA library for icons. (I have added my own CDN hosted snippet for the demo)
#2 Use jQuery to control the opening and closing of the slider.
I built a raw demo for you to play with and then implement in your own case study, with comments
$('.primary-i').click(function() {
$('.secondary').toggleClass('open'); //this adds the class .open or removes it if its already there (thus closing and opening the .secondary class element by reducing its width back to 0 or augmenting it to 180px //
});
nav {
position:relative;
}
.primary-i {
cursor:pointer;
}
.primary, .secondary {
width:180px;
}
.primary-i, .secondary-i {
display:flex;border:1px solid black;
padding:4px;width:150px;
}
.primary-i i:nth-child(1), .secondary-i i:nth-child(1) {
margin-right:10px;
}
.primary-i i:nth-child(3), .secondary-i i:nth-child(3) {
margin-left:70px;
}
.secondary {
width:0!important;overflow-x:hidden;
}.secondary.open {
width:180px!important;transition:0.5s ease;
}
.secondary {
position:absolute;top:0;left:158px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.15.1/css/all.css" integrity="sha384-9ZfPnbegQSumzaE7mks2IYgHoayLtuto3AS6ieArECeaR8nCfliJVuLh/GaQ1gyM" crossorigin="anonymous">
<nav>
<div class="primary">
<div class="primary-i">
<i class="fa fa-shopping-cart"></i><span>Item</span>
<i class="fa fa-angle-right"></i>
</div>
<div class="primary-i">
<i class="fa fa-shopping-cart"></i><span>Item</span><i class="fa fa-angle-right"></i>
</div>
<div class="primary-i">
<i class="fa fa-shopping-cart"></i><span>Item</span><i class="fa fa-angle-right"></i>
</div>
<div class="secondary">
<div class="secondary-i">
<i class="fa fa-shopping-cart"></i><span>Item</span>
</div>
<div class="secondary-i">
<i class="fa fa-shopping-cart"></i><span>Item</span>
</div>
</div>
</div>
</nav>
Codepen to play with : https://codepen.io/thewhitegrizzzzli/pen/qBNNNgG

Adjusting spacing in a list containing icon and text in HTML

Whenever I've to use a long section name inside a container with a list for a small column (col-2). My text is getting beneath my fontawesome icon as shown below. Thanks in advance!
PFB the HTML code:
<ul class="js-scroll-nav list-group list-group-transparent list-group-flush list-group-borderless py-3 px-3">
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#online">
<i class="fas fa-play-circle fa-lg"></i> List Item Apple Strudel
</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#discourses"><i class="fas fa-play-circle fa-lg"></i> List Item PumpkinStrudel
</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#disciple"><i class="fas fa-play-circle fa-lg"></i> List Item BerryStrudel</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#yogic"><i class="fas fa-play-circle fa-lg"></i> List Item CokeStrudel</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#events"><i class="fas fa-play-circle fa-lg"></i> List Item DoritosStrudel</a>
</li>
</ul>
How can I leave space below fontawesome icon so that my text on the second line populates exactly below from where my first text starts as shown below:
Don't use for spacing. Use padding/margin as appropriate.
What we want to do here is set the a element to have position:relative and the icon to be positioned absolutely within it. Then in the a element we set the left padding appropriately to indent the text.
Adjust the values below to taste. Perhaps add your own classes instead of overriding bootstrap classes directly.
a.list-group-item-action {
position: relative;
padding-left: 30px;
}
.list-group-item-action i.fas {
position: absolute;
left: 10px;
}
.list-group {
width:30%;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<ul class="js-scroll-nav list-group list-group-transparent list-group-flush list-group-borderless py-3 px-3">
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#online">
<i class="fas fa-play-circle fa-lg"></i>List Item Apple Strudel
</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#discourses"><i class="fas fa-play-circle fa-lg"></i>List Item PumpkinStrudel
</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#disciple"><i class="fas fa-play-circle fa-lg"></i>List Item BerryStrudel</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#yogic"><i class="fas fa-play-circle fa-lg"></i>List Item CokeStrudel</a>
</li>
<li>
<a class="list-group-item list-group-item-action font-weight-medium mb-0 mb-md-2" href="#events"><i class="fas fa-play-circle fa-lg"></i>List Item DoritosStrudel</a>
</li>
</ul>

bootstrap footer does not cover entire width of page

I'm having trouble having my footer cover the whole page. it's fine on an extra large screen but when I test it on lg,md,sm, there is a margin on the right side that scrolls to the right. It extends the width of the screen larger than the size of the screen (viewport?). Here is some code I have.
<footer class="footer text-center" style="height:420px; margin-top:220px">
<div class="container">
<h1 class="text-secondary col-lg text-center col-md offset-md-1" style="margin-bottom:5%">Contact</h1>
<div class="row" style="height:200px; margin-top:-2%">
<div class="col-md-4 mb-5 col-lg-4 col-md" style="">
<h4 class="text-uppercase mb-4 text-secondary"><u>Get in touch</u></h4>
<div class="col-lg col-md" style="">
<p class="footer-contact text-primary text-left"><i class="fa fa-home"></i> 9416 Barry dr, Romulus, MI</p>
<p class="footer-contact text-primary text-left"><i class="fa fa-phone"></i> 703-517-0030</p>
<p class="footer-contact text-primary text-left"><i class="fa fa-envelope"></i> hellochrisyou#gmail.com</p>
</div>
</div>
<div class="col-lg-4 col-md-3 offset-md-2" style="background-color:#ffffff; margin-left:0.5%">
<h4 class="text-uppercase col-lg text-secondary text-center"><u>Social Media</u></h4>
<ul class="list-inline mb-0 footer-social">
<li class="list-inline-item">
<a class="btn btn-outline-light btn-secondary text-center rounded-circle" href="#">
<i class="fa fa-fw fa-facebook icon-margin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-secondary text-center rounded-circle" href="#">
<i class="fa fa-fw fa-google-plus icon-margin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-secondary text-center rounded-circle" href="#">
<i class="fa fa-fw fa-twitter icon-margin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-secondary text-center rounded-circle" href="#">
<i class="fa fa-fw fa-linkedin icon-margin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-secondary text-center rounded-circle" href="#">
<i class="fa fa-fw fa-github icon-margin"></i>
</a>
</li>
</ul>
</div>
<div class="col-md-4 col-lg-4" style="margin-left:-0.5%">
<h4 class="text-uppercase mb-4 text-secondary"><u>Popular Links</u></h4>
<div class="container-fluid">
<div class="row footer-wide"">
<ul class="nav navbar-nav col-lg text-center" style="margin-left:5%">
<li><a style="color:#d3d3d3" href="#section1">Home</a></li>
<li><a style="color:#d3d3d3" href="#section2">About Me</a></li>
<li><a style="color:#d3d3d3" href="#section3">Education</a></li>
<li><a style="color:#d3d3d3" href="#section4">Skills</a></li>
<li><a style="color:#d3d3d3" href="#section5">Portfolio</a></li>
<li><a style="color:#d3d3d3" href="#section6">Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</footer>
thanks.
Chris
EDIT:
The issue with this is that when you use 100vw for example, the scroll bar is taken in account for. As most people recommend, always use max-width as 100% to avoid any browser scroll bars.
Add these rules to your html and body css tags
max-width: 100%;
overflow-x: hidden;
if you are using Bootstrap
Make sure that your container class is .container-fluid
if the body container is only .container, then you can make separate container for the footer class set to .container-fluid and make its style="padding:0;margin:0"
====================
<body>
<div class="container">
html coding......
</div>
<div class="container-fluid" style="padding:0;margin:0">
<footer>
html coding.......
</footer>
</div>
</body>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.2/css/bootstrapValidator.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"/>
<link href="https://fonts.googleapis.com/css?family=Work+Sans:400,500,700" rel="stylesheet"/>
<link rel="stylesheet" href="static/font-awesome/css/font-awesome.min.css"/>
<link rel="stylesheet" href="source.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<!-- Navigation -->
<nav class="navbar navbar-default bg-secondary fixed-top" style="height:200px" id="mainNav" role="navigation">
<div class="container">
<div class="row">
<p class="navbar-brand font-title col-xl-4 offset-xl-4 col-lg-4 offset-lg-4 col-md-4 offset-md-4 col-sm-4 offset-sm-3 text-center">Chris You</p>
</div>
<div class="row">
<a class="font-menu col-xl col-lg col-md col-sm text-center" style="color:#d3d3d3" href="#section1">Home</a>
<a class="font-menu col-xl col-lg col-md col-sm text-center" style="color:#d3d3d3" href="#section2">About Me</a>
<a class="font-menu col-xl col-lg col-md col-sm text-center" style="color:#d3d3d3" href="#section3">Education</a>
<a class="font-menu col-xl col-lg col-md col-sm text-center" style="color:#d3d3d3" href="#section4">Skills</a>
<a class="font-menu col-xl col-lg col-md col-sm text-center" style="color:#d3d3d3" href="#section5">Portfolio</a>
<a class="font-menu col-xl col-lg col-md col-sm text-center" style="color:#d3d3d3" href="#section6">Contact</a>
</div>
</div>
</nav>
<!--image-->
<div class="row" style="margin-top:300px">
<img class="col-xl-2 offset-xl-5 col-lg-4 offset-lg-4 col-md-4 offset-md-4 col-sm-4 offset-sm-4" src="me.gif">
</div>
<!--Description-->
<div class="jumbotron jumbo-header">
<div class="row">
<p class="about-title text-third text-center col-12"><strong>Software Developer</strong></p>
</div>
<p class="about-text text-primary text-left col-xl-4 offset-xl-4 col-lg-7 offset-lg-3 col-md-6 offset-md-3 col-sm-8 offset-sm-2"> Hi! I'm Chris. I am a very passionate software developer based in Detroit, MI. Highly motivated to write clean and effective code. I specialize in Java, C#, C++. Feel free to contact me!</p>
</div>

Bootstrap 4: Vertical align floated element in a list

How can I float a fontawesome icon to the right and still have it vertically middle aligned? I've tried using ml-auto and Flexbox, but it's not working.
Here's my code:
<ul class="list-group flex-column">
<li class="list-group-item py-2 d-flex justify-content-start">
<a href="#">
<img src="https://placehold.it/40x40" height="40" class="mr-4">
<span>Text Here</span>
<i class="fa fa-angle-right ml-auto" aria-hidden="true"></i>
</a>
</li>
</ul>
Can someone help me out? Thanks!
Use the flex and sizing helper classes to make the link a flex parent with 2 children - the content you want on the left, and the content on the right. Use .justify-content-between, .align-items-center to separate the content so the arrow is on the right and centered vertically.
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<ul class="list-group flex-column">
<li class="list-group-item py-2 d-flex">
<a href="#" class="d-flex w-100 justify-content-between align-items-center">
<span>
<img src="https://placehold.it/40x40" height="40" class="mr-4">
<span>Text Here</span>
</span>
<i class="fa fa-angle-right ml-auto" aria-hidden="true"></i>
</a>
</li>
</ul>
Try with this structure:
<ul class="list-group">
<li class="list-group-item">
<a class="w-100 d-flex align-items-center py-2" href="#">
<img src="https://placehold.it/40x40" height="40" class="mr-4">
<span>Text Here</span>
<i class="fa fa-angle-right ml-auto" aria-hidden="true"></i>
</a>
</li>
</ul>
Click here to see it working in jsfiddle.
Your <a> tag doesn't fill the entire parent, so you can't see the effect of ml-auto on the icon. Also d-flex must be in the a tag, not in li.