How to remove Input image border

4

I'm using a input of image to function as a favorite button

<input type="image" class="btnFav" title="Favoritar" />

But it has a square border on it

I've tried using css below, but nothing worked.

outline-color: invert;
outline-style: none;
outline-width: medium;
-moz-outline-style: none;
outline: none;
-webkit-box-shadow: none;
box-shadow: none;
border: 0;
border: none;

Someone can help, preferably without using javascript, only with css .

Link: JSFiddle

    
asked by anonymous 20.11.2015 / 23:56

2 answers

3

Your problem occurs because input type="image" expects that there is a src attribute, that is, the image definition must be done directly on the button, which means :hover does not have the correct effect , because the background image will be "behind" the src image.

To solve your problem, simply change the input to submit and continue using the :hover images you already have in css.

Looking like this:

<input type="submit" class="btnFav" title="Favoritar" value="" />

I put the attribute of value with no value so that the default "Send" script does not stay behind the image.

Note also that all input types have standard css that apply border and outline, to get rid of completely, just remove those properties directly in the input css, like this:

input[type="submit"] {
    border: none;
    outline:none;
}

Or just

input {
    border: none;
    outline:none;
}

See the example working: link

    
21.11.2015 / 01:11
1

Try the following

input[type="image"]{
    outline: none;   
}

input[type="image"]:focus{
    outline: none;   
}

Good luck, any questions ask via comment

I did the tests on the link that passed me and no css is needed to solve the problem, do the following:

<div class="btnFav" title="Favoritar" />

Switch input to div and everything is fine

    
21.11.2015 / 00:14