Is there a way of completely removing the styling of a button in Internet Explorer? I use a css sprite for my button, and everything looks ok.
But when I click the button, it moves to the top a little, it makes it look out of shape. Is there a css click state, or mousedown? I don't know what triggers that state.
I know it's not a really big deal, but sometimes it's the small things that matter.
This question is related to
html
css
internet-explorer
button
state
Try removing the border from your button:
input, button, submit
{
border:none;
}
I think it's the button "active" state.
In bootstrap 4 is easiest.
You can use the classes:
bg-transparent
and border-0
I think this provides a more thorough approach:
button, input[type="submit"], input[type="reset"] {_x000D_
background: none;_x000D_
color: inherit;_x000D_
border: none;_x000D_
padding: 0;_x000D_
font: inherit;_x000D_
cursor: pointer;_x000D_
outline: inherit;_x000D_
}
_x000D_
<button>Example</button>
_x000D_
Add simple style to your button
.btn {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}
Your question says "Internet Explorer," but for those interested in other browsers, you can now use all: unset
on buttons to unstyle them.
It doesn't work in IE, but it's well-supported everywhere else.
https://caniuse.com/#feat=css-all
Old Safari color warning: Setting the text color
of the button after using all: unset
can fail in Safari 13.1, due to a bug in WebKit. (The bug is fixed in Safari 14 and up.) "all: unset
is setting -webkit-text-fill-color
to black, and that overrides color." If you need to set text color
after using all: unset
, be sure to set both the color
and the -webkit-text-fill-color
to the same color.
Accessibility warning: For the sake of users who aren't using a mouse pointer, be sure to re-add some :focus
styling, e.g. button:focus { outline: orange auto 5px }
for keyboard accessibility.
And don't forget cursor: pointer
. all: unset
removes all styling, including the cursor: pointer
, which makes your mouse cursor look like a pointing hand when you hover over the button. You almost certainly want to bring that back.
button {
all: unset;
color: blue;
-webkit-text-fill-color: blue;
cursor: pointer;
}
button:focus {
outline: orange 5px auto;
}
_x000D_
<button>check it out</button>
_x000D_
Source: Stackoverflow.com