Font-awesome, input type 'submit'

前端 未结 7 1895
挽巷
挽巷 2020-11-28 01:19

There seems to be no class for input type \'submit\' in font-awesome. Is it possible to use some class from font-awesome for button input? I\'ve added icons to all buttons (

相关标签:
7条回答
  • 2020-11-28 01:57

    HTML

    Since <input> element displays only value of value attribute, we have to manipulate only it:

    <input type="submit" class="btn fa-input" value="&#xf043; Input">
    

    I'm using &#xf043; entity here, which corresponds to the U+F043, the Font Awesome's 'tint' symbol.

    CSS

    Then we have to style it to use the font:

    .fa-input {
      font-family: FontAwesome, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    }
    

    Which will give us the tint symbol in Font Awesome and the other text in the appropriate font.

    However, this control will not be pixel-perfect, so you might have to tweak it by yourself.

    0 讨论(0)
提交回复
热议问题