Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Space between link and icon, fontawesome

What's the best way to get a space between the link/paragraph and the icon?

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">  <a href="#/upgrade/selection"><i class="fa fa-reply"></i>Change</a>

Doesn't work to just put a space before the text because it will be changed back when you minify/uglify the project.

I tried with all kinds of padding and margins. Can't get them to separate.

like image 557
Joe Avatar asked Jan 15 '15 17:01

Joe


People also ask

How do you put a space between an icon and text in bootstrap?

Put &nbsp; between the text and icon. EDIT: As your comment below that you can't add additional tags inside the a tag, you can actually add an &nbsp; or a whitespace but using your code, the icon is placed on the left not on the right as the image shows.


2 Answers

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 enter image description here

like image 92
Christina Avatar answered Oct 16 '22 23:10

Christina


Don't know if is the best but you can add some margin-right to the i element:

i {    margin-right: 10px;  }
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">  <a href="#/upgrade/selection"><i class="fa fa-reply"></i>Change</a>
like image 40
user2019037 Avatar answered Oct 17 '22 01:10

user2019037