Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Font Awesome icon a submit for a form

I'm trying to make a font awesome icon (empty square) clickable inside a form post. However, the code I tried showed the icon inside a button. I do not need the button, not the aesthetic I am looking for (see attached screenshot). Any thoughts? I am using this html code (showing the submit code only to keep it simple):

<!--input type="image" class="fa fa-square-o fa-lg" /-->
<button type="submit" id="completed-task">
      <i class="fa fa-square-o fa-lg"></i>
</button>

enter image description here

like image 643
sOltan Avatar asked Dec 03 '15 04:12

sOltan


People also ask

How do I add Font Awesome icons to form?

The font-awesome icon can be placed by using the fa prefix before the icon's name. Example: In this example, we will take a form where the input field is necessary. After that, we will place the font-awesome icon inside the input field. We will use the CDN link to use the font-awesome icons.

How do you add an icon to a form field?

Open our free Bootstrap Form Builder in your browser. Add a field from the "Add a Field" tab. Select "Icon" from the Prepend or Append dropdown in the "Edit Fields" tab. Choose an icon from the icon picker window.

How do I use Font Awesome icons in email template?

You should find it in File >> Glyphs >> Select Fontawsome. Hope it helps.

How do you reference Font Awesome icons in HTML?

Add Icons to HTML We recommend using <i> element with the Font Awesome CSS classes for the style class for the style of icon you want to use and the icon name class with the fa- prefix for the icon you want to use.


1 Answers

You can hide the button by taking away the border, background and padding;

<button type="submit" id="completed-task" class="fabutton">
      <i class="fa fa-square-o fa-lg"></i>
</button>

.fabutton {
  background: none;
  padding: 0px;
  border: none;
}

@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');

.fabutton {
  background: none;
  padding: 0px;
  border: none;
}
<button type="submit" id="completed-task" class="fabutton">
      <i class="fa fa-square-o fa-lg"></i>
</button>
like image 132
Ieuan Avatar answered Sep 27 '22 18:09

Ieuan