Changing form button style without losing 3d effect - html

In Firefox and Internet Explorer, disabled buttons look greyed out and unclickable. But Chrome renders them just the same as enabled buttons.
How can I change the style of a button (for example its color) without losing the 3d effect, in order to make it look disabled?
I am not asking how to make my own CSS button that looks the same in all browsers. I want to use the browser default buttons, but add an additional style to disabled buttons for those browsers that do not have a different style for them.
So far, everything I tried, like for example changing the background color or background image, made the button lose the 3d effect. The result looks like this, which is not what I want:
This is the result in Firefox, but it looks similar in the other browsers. The button looks much different from the default one.

You could add some transparency to the disabled buttons.
button {
padding: 10px;
}
button:disabled {
opacity: 0.6;
}
<button>button</button>
<button disabled>button disabled</button>

You can do this using background gradients
https://jsfiddle.net/ammfoh3j/
There is a really useful site you can use to generate whatever kind of 3D looking effect you would like
http://www.colorzilla.com/gradient-editor/
<style>
button {
margin:0px; padding:0px;
background: #e4f5fc;
background: linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed 100%);
}
</style>
<button>anything</button>
More accurate/pretty http://jsfiddle.net/j3Lgs3x5/2/

Related

There is a border around my buttons and when I click somewhere on the screen it disappears

I am having a problem, where there is a border(different in different browsers, blue in safari, a dotted black in chrome) around my buttons when they first load. I am guessing it's some sort of selecting but I want to disable it. How can I do so, that there is no border on the initial loading of the buttons. Here is what I mean:
It is called an outline. Try this:
button:focus {outline:0 !important;}
Worth noting that this will become an accessibility issue if removed.
This border is an outline. It's provided by browsers
You can also use:
button:focus {outline: none;}
Click here for more information.
If you want to remove it, use this.
.buttonclass {
outline:none;
}
<button class="buttonclass">Button</button>
If you want to keep it but you don't want that it should be visible, use this.
.buttonclass:focus {
outline:hidden;
}
<button class="buttonclass">Button</button>
However I don't think a button has an outline.

CSS bug doubleclick changes text image and header background as well as font color

I don't want my html tags to change color and background when there is double click on it as you can see in this picture "Question" changes its color to white and background to blue when I doubeclicked on it. How I can solve this problem?
What you're referring to is a css ::selection attribute. The color isn't really changing, this is a native browser behavior to help users select and copy text. You can get rid of it but you must understand that you'll be breaking a very important usability pattern. People expect selection to work, even if it is stylized it should be there.
I would strongly advise you not to disable this behavior but customize it to fit your design if you really must.
p::selection {
color: red;
background: yellow;
}
div::selection {
color: green;
background: blue;
}
<p>Questions that may already have your answer</p>
<div>Another option of text highlight</div>
That's the default selection behavior for your browser. If you want to disable selection altogether you can use user-select: none; on your element.

How to make the carat visible in IE when the background color is dark gray?

I have a login page that can be themed by the user with any background color, image, or both. The username/password inputs will have transparent backgrounds to allow the page background to bleed through. In one customer case, the background color was chosen as #867d7d. They claim the carat (they called it the "cursor") is not visible while focused into the fields. The carat actually is there blinking like normal, but its color is so close to the background color that you can't see it.
Is there any way to make the carat visible in this case?
Edit: This works fine in Chrome and Firefox, the issue is only happening in Internet Explorer.
Here is a live demo: JSFiddle
<style>
body { background-color: #867d7d; }
input { color: white; background-color: transparent; width: 100%; }
</style>
<input placeholder="The caret is nearly invisible in IE">
This seems that IE respect the windows theming, instead config-able from its browser level.
You can change yoru windows theming here: "Control Panel\Appearance and Personalization\Personalization", and pick some extreme color you will see the carat color got changed.
I am hope IE would have carat color CSS styles.

Change disabled input text text color in Opera

Tried to find an answer, but I guess my search skills needs a makeover. Anyways:
I am doing some styling to a text field (input) when it's disabled. Basically I'm making the background dark gray and the font color white. This works perfectly (Safari needed a -webkit-text-fill-color property in addition to color: white;) - but opera is not listening to me!
No matter what I do, where I do it, and how I do it, the font color is still a pretty dark gray (which I assume is the standard color). If I remove the disabled-attribute, everything works perfectly.
excerpt of my CSS styling for the disabled style:
#customerNumberSearch[disabled="disabled"],
#customerNumberSearch:disabled {
color: white;
-webkit-text-fill-color: white;
}
So, how do you change the font color of a disabled input field in Opera?
Edit - alternative solution: This problem can be circumvented by changing out the disabled-attribute for readonly. This has some side effects, however, so make sure this works for you. A nice side effect is that this also fixes the problem in <= IE9
Try
input[disabled] { color: red;}
Can u try one of these:
[disabled] {
color:#fff;
}
OR
#customerNumberSearch[disabled] {
color:#fff !important;
}

How To Disable Blue Glow For Html Button In Ie9

I know this question has been asked before, but I'm having some difficulty getting it to work in IE9. I have an html page with 3 forms in it (since each form contains a request to a different resource on a website). The html looks like this:
<form action="/SomeController1/Action" method="get"><button name="action" value="someValue">Request the first thing</button></form>
<form action="/SomeController2/Action" method="get"><button name="action" value="someValue">Request the second thing</button></form>
<form action="/SomeController3/Action" method="get"><button name="action" value="someValue">Request the third thing</button></form>
I'm trying to disable the blue glow that is showing up on all three buttons when the page loads. I think it looks really confusing...
The solution that I'm trying to implement, which doesn't seem to be working, is:
button
{
outline-width: 0px;
outline: none;
}
At any rate, the glow doesn't appear in Firefox or Chrome, it just seems to be appearing in IE. I suppose I could just use one form and put 3 buttons in it, but this seems a bit more like a workaround rather than a solution. Is there any way to do this using CSS or javascript? Any help will be appreciated!
Thanks!
Edit - Here's an image of the problem:
I was just hoping to get rid of the blue color.
You can't just get rid of it, because Internet Explorer uses the native buttons, from your system theme. Take a look at any system dialog box with a button, for example when you change your wallpaper.
You can only remove the blue inner glow if you're willing to style a decent looking button yourself, starting with setting a border/background (which disables using the native style).
with 'glow' you mean a border? in that case, just do;
button { border: 0; }
I don't have IE 9 to test---but generically in CSS, you should try
button:focus {
outline:none;
box-shadow:none;
}
Adapted from "Removing the blue glow from an HTML text input when selected".