简体   繁体   中英

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

I tried unicode in value like  and added the fontawesome in css. but didn't work out. I am trying to put delete icon on table chart in. can anyone tell me please how can i add fontawesome icons in value tag?

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"; 
}

You have to add the links of Font Awesome to your head tag and it will work.

Second option is to wrap input in div and set icon in :before of div

 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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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