dongyizhuang0134
2017-10-03 10:09
浏览 228
已采纳

Fontawesome里面的提交按钮

I have this line of code:

<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search Products', 'paralinx' ); ?>" />

How can I add a font awesome icon before the "Search Products" text?

I tried using :before in the input field but it does not work.

Hope you can help

图片转代码服务由CSDN问答提供 功能建议

我有这行代码:

 &lt; input  type =“submit”class =“submit”name =“submit”id =“searchsubmit”value =“&lt;?php esc_attr_e('Search Products','paralinx');?&gt;”  /&gt; 
   
 
 

如何在“搜索产品”文本之前添加字体真棒图标?

我尝试过使用 :在输入字段之前但它不起作用。

希望你能提供帮助

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dongwen7187 2017-10-03 10:12
    已采纳

    :before and :after are only available on elements that can have content in between an opening and a closing tag. <input type=submit> cannot have content.

    Use

    <button type="submit" class="submit" name="submit" id="searchsubmit"><?php esc_attr_e( 'Search Products', 'paralinx' ); ?></button> 
    

    instead, it does allow the usage of :before.

    已采纳该答案
    打赏 评论
  • duannan4486 2017-10-03 10:15

    You should use :before pseudo-element with 'content' property:

    .submit:before {
     content: "";
     display: block;
     background: url("icon.jpg") no-repeat;
     width: 20px;
     height: 20px;
     float: left;
     margin: 0 6px 0 0;
    }
    
    打赏 评论
  • drfu29983 2017-10-03 10:23

    Use button tag

    <button type="submit" class="submit" name="submit" id="searchsubmit" ><i class="fa fa-check"></i> <?php esc_attr_e( 'Search Products', 'paralinx' ); ?></button>
    
    打赏 评论

相关推荐 更多相似问题