Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert space between text and icon in bootstrap?

I use of bootstrap in my website .When I add glyphicon glyphicon-user class to the a tags icons appear with out any space .Please advice

<a style="padding-left: 10px; padding-right: 10px; border-left-width: 10px; border-left-style: solid; margin-left: 10px;" id="dnn_dnnUser_enhancedRegisterLink" title="ثبت‌نام" class="glyphicon glyphicon-user" rel="nofollow" >ثبت‌نام</a>

enter image description here

like image 521
hmahdavi Avatar asked Nov 28 '15 05:11

hmahdavi


2 Answers

Put &nbsp; between the text and icon.

Example:

<a style="padding-left: 10px; padding-right: 10px; border-left-width: 10px; border-left-style: solid; margin-left: 10px;" id="dnn_dnnUser_enhancedRegisterLink" title="ثبت‌نام"  rel="nofollow" >
    ثبت‌نام &nbsp; <span class="glyphicon glyphicon-user"></span>
</a>

A whitespace will do also

<a style="padding-left: 10px; padding-right: 10px; border-left-width: 10px; border-left-style: solid; margin-left: 10px;" id="dnn_dnnUser_enhancedRegisterLink" title="ثبت‌نام"  rel="nofollow" >
    ثبت‌نام <span class="glyphicon glyphicon-user"></span>
</a>

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.

Using your code add an &nbsp; or a whitespace before the text but the icon is on the left.

<a style="padding-left: 10px; padding-right: 10px; border-left-width: 10px; border-left-style: solid; margin-left: 10px;" id="dnn_dnnUser_enhancedRegisterLink" title="ثبت‌نام" class="glyphicon glyphicon-user" rel="nofollow" >&nbsp;ثبت‌نام</a>
like image 183
John Louie Dela Cruz Avatar answered Sep 22 '22 05:09

John Louie Dela Cruz


Assuming the text is to the left, how about adding style="padding-left:10px" to your span?

<p>Envelope icon as a link:
    <a href="#">
      <span style="padding-left:10px" class="glyphicon glyphicon-envelope"></span>
    </a>
  </p>
like image 42
user3590235 Avatar answered Sep 23 '22 05:09

user3590235