Wosley Alarico Wosley Alarico - 1 year ago 146
CSS Question

Fontawesome inside submit button

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

Answer Source

: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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download