Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: Remove shadows on disabled HTML buttons

When disabling HTML buttons, a shadow gets added to the button text. I'm styling the buttons myself and I would like to only have the one colour (white) with NO shadow but I do not know how to do it efficiently.

My previous method was to leave it enabled and re-style the button's hover + active states and ignore the click vai Javascript. Told you, not very efficient!

http://jsfiddle.net/gLfMX/

EDIT: image to show the shadow (being viewed in IE9) + a zoomed version.

enter image description here

like image 734
Alex Guerin Avatar asked Jan 07 '12 03:01

Alex Guerin


People also ask

How do I remove a button shadow in bootstrap?

Use the . shadow-none class in Bootstrap to remove shadow.

What is adding shadows in Dynamic HTML?

Adding box shadows Shadows are a common design feature that can help elements stand out on your page. In CSS, shadows on the boxes of elements are created using the box-shadow property (if you want to add a shadow to the text itself, you need text-shadow ).


2 Answers

You already posted your own answer, but here's a bit more info.

From my experiments I've reached the same conclusion: on IE, you cannot change it from CSS. Here's why.

The colors of disabled buttons depend on what Windows is configured to show for the "3D Objects" item in "Window Color and Appearance" (under display settings).

The default colors of the disabled buttons are: text = A0A0A0, shadow = white. They may be different if the user changed the defaults (in Windows 7 you have to go into 'advanced settings' to do it), but almost everyone will have these. They were designed to fit the system default background color of a disabled button, which is F4F4F4.

enter image description here

My solution for this problem is to design the CSS so that at least for the default settings, under IE a disabled button will look OK - the best approach is to set the background when disabled to F4F4F4:

button[disabled], a[disabled] {
    background-color: #f4f4f4;
}

If you're using Bootstrap like me, you should do this instead:

.btn[disabled], .btn.disabled[disabled] {
    background-color: #f4f4f4;
}

You can also add some conditional selector to enable this only for IE.

like image 118
sinelaw Avatar answered Sep 21 '22 05:09

sinelaw


add border:none; to get rid of the shadow jsfiddle

like image 45
Danferth Avatar answered Sep 23 '22 05:09

Danferth