How to maintain equal spacing between font icons in a navigation bar when texts with font-icons are used as link?
You can use CSS flexbox, and use justify-content:space-between(around)
in your ul
body { margin: 0;}
.navbar { background-color: #495057; width: 100%;}
.navbar ul { display: flex; justify-content: space-around; text-align: center; list-style-type: none; padding: 20px}
.navbar ul li a { text-decoration: none; color: #adb5bd;}
.navbar ul li a:hover { color: white;}
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet" />
<div class="navbar"> <ul> <li> <a href="#"> <i class="fas fa-font"></i> <div>test</div> </a> </li>
<li> <a href="#"> <i class="fas fa-font"></i> <div>123test123</div> </a> </li>
<li> <a href="#"> <i class="fas fa-font"></i> <div>12345test12345</div> </a> </li>
<li> <a href="#"> <i class="fas fa-font"></i> <div>12test12</div> </a> </li>
<li> <a href="#"> <i class="fas fa-font"></i> <div>1test1</div> </a> </li> </ul></div>
Space between link and icon, fontawesome
I would use the .fa-fw
class. For example: <i class="fa fa-cog fa-fw">
This adds a visual space (that won't get stripped out) and it's consistent, so when/if the elements stack it looks a lot better.
Instructions: https://fontawesome.com/how-to-use/on-the-web/styling/fixed-width-icons
How to make a space between icon and text in CSS
Try one of the below methods as mentioned in Fontawesome examples page
Text outside i
tag, and add a space in between
<i class="fab fa-facebook"></i> Facebook
Use
, below code is from Fontawesome site
<a class="list-group-item" href="#"><i class="fa fa-home fa-fw" aria-hidden="true"></i> Home</a>
If you dont want to change your markup(html) use the below CSS
.login-with > a i::before {
padding-right: 15px;
}
Can I add spacing around an icon in Flutter Bottom Navigation Bar?
You could try to add a Padding widget (https://api.flutter.dev/flutter/widgets/Padding-class.html) around your Icon that uses Font awesome.
How to make a space between i tags (icons) in table?
Just apply a padding (or a margin, depending on the style you've used) between elements, e.g.
td a + a {
padding-left: 3em;
}
Changing the space between each item in Bootstrap navbar
You can change this in your CSS with the property padding
:
.navbar-nav > li{
padding-left:30px;
padding-right:30px;
}
Also you can set margin
.navbar-nav > li{
margin-left:30px;
margin-right:30px;
}
Related Topics
How to Set Filename for Base64 Rendered Pdf Using Object Tag
Css - How to Make the Checkbox and Label in One Line
How to Type Text With Hat "^" in HTML
Nested Ngfor Looping Over an Array of Objects
Add Line Break Within Tooltips
Make a Div Fill the Height of the Remaining Screen Space
Recommended Way to Embed Pdf in Html
How to Overlay One Div Over Another Div
Why Doesn't Nth-Of-Type/Nth-Child Work on Nested Elements
Vertically Align an Image Inside a Div With Responsive Height
Setting Attribute Disabled on a Span Element Does Not Prevent Click Events
Html and CSS Are Not Linking/ Communicating
Preventing Overlap of Multiple Fixed Positioned Elements
How to Disable an Input Dynamically With Angular 7
Css Height 100% Is Not Always Equal to the Direct Parent
Maintain the Aspect Ratio of a Div With Css