繁体   English   中英

如何在PHP中使用提交类型在输入中添加fontawesome图标

[英]How can i add fontawesome icon in input with submit type in php

我尝试了等值的unicode,并在CSS中添加了fontawesome。 但没有解决。 我正在尝试将删除图标放在表格中。有人可以告诉我如何在值标签中添加fontawesome图标吗?

HTML

<form method="post">
    <input type="hidden" name="post_id" value="<?php echo $post_id ?>">
    <?php 
        echo '<td><input type="submit" name="delete" value="&#xf2ed;" class=""></td>';
    ?>
</form>

css

input[type="submit"] {
  font-family: "Font Awesome 5 Free"; 
}

您必须将Font Awesome的链接添加到您的head标签中,然后它才能工作。

第二个选择是包裹input的股利和一套icon:beforediv

 input[type="submit"] { font-family: "Font Awesome 5 Free"; } .secodOption:before { font-family: "Font Awesome 5 Free"; content: "\\f2ed"; font-weight: 900; position: absolute; padding-top: 2px; padding-left: 7px; } input[value=""]{ width: 30px; } 
 <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> <input type="submit" name="delete" value="&#xf2ed;" class=""/> <table> <tr> <td><div class="secodOption"><input type="submit" value="" name="delete"/></div></td> </tr> </table> 

暂无
暂无

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

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