简体   繁体   English

在按钮内对齐文本/图标

[英]Aligning Text / Icon Within Button

I've tried many different things on the web and from SO and again can't seem to get this to work. 我在Web上以及从SO上尝试了许多不同的方法,再次似乎无法使它正常工作。 First time I've been changing / styling my buttons and they're driving me mad! 第一次,我一直在改变/样式我的按钮,他们让我发疯! So I have a left floated button on the same line as my right floated button now. 因此,我现在的左浮动按钮与右浮动按钮在同一行上。 I'd like to see if I can have the icon to the left of the text on the left button and the right of the text on the right button. 我想看看是否可以在左侧按钮的文本左侧和右侧按钮的文本右侧添加图标。 Like this: 像这样:

<- Last Page //////////////////////////////////////////////// Next Page -> <-最后一页/////////////////////////////////////////////// //下一页->

<span align="right">
<ul class="actions">
<li id="leftbutton"><a href="tfn.html" class="button special icon fa-arrow-left">TFN</a></li>
<li id="rightbutton"><a href="medical-indemnity-and-insurance.html" class="button special icon fa-arrow-right">Indemnity & Insurance</a></li>
</ul>
</span> 

Fiddle 小提琴

For some reason on the above fiddle it doesn't seem to be showing the font awesome arrows? 由于上述原因,它似乎没有显示出真棒的箭头?

Thank you so much! 非常感谢!

S. S.

Just insert te font-awsome icons whit the <i> element: 只需在<i>元素中插入字体令人讨厌的图标:

<span align="right">
  <ul class="actions">
     <li id="leftbutton"><a href="tfn.html" class="button special icon"><i class="fa fa-arrow-left" aria-hidden="true"></i> TFN</a></li>
     <li id="rightbutton"><a href="medical-indemnity-and-insurance.html" class="button special icon ">Indemnity & Insurance <i class="fa fa-arrow-right" aria-hidden="true"></i></a></li>
  </ul>
</span>

Here is an updated fiddle: https://jsfiddle.net/n6bpvdf5/1/ 这是更新的小提琴: https : //jsfiddle.net/n6bpvdf5/1/

class will be fa fa-arrow-right not icon fa-arrow-right . 该类将是fa fa-arrow-right而不是icon fa-arrow-right

Like <a href="tfn.html" class="button special fa fa-arrow-left">TFN</a> <a href="tfn.html" class="button special fa fa-arrow-left">TFN</a>

It's always best practice to use <i> tag when you use a font awesome icon 最好的做法是在使用超棒字体图标时使用<i>标记

Like <a href="tfn.html" class="button special"><i class="fa fa-arrow-left" aria-hidden="true"></i>TFN</a> 就像 <a href="tfn.html" class="button special"><i class="fa fa-arrow-left" aria-hidden="true"></i>TFN</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM