I'd like to know, how to remove default arrow of selectbox and gradations in Checkbox and I wanna use custom image on it.
for example, here is some code.
<select class="selectParent">
<option value='1'>Title</option>
<option value='2'>Description</option>
<option value='3'>Author</option>
</select>
I searched some solutions to remove default status using -webkit- appearance; and -moz- appearance; but I have no idea in IE. Is there any possibility to remove a default status in IE?
as a same logic, I'd like to know, how to remove default status in checkbox.
<input type="checkbox" name="category" id="category10"/>
I'll be wating for good answers thx
appearance: none would work, but this is not a cross-browser way to do it.
select, input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
DEMO
EDIT:
Here is a cross-browser method for checkbox,
http://jsfiddle.net/kyLq4/1/
This is currently possible in all browsers except Opera (although that should work when it switches to Blink).
For Firefox and WebKit/Blink, you need to use appearance: none;, which is fairly heavy handed and removes all styling:
input[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
}
You can also include the prefixless version if you wish, although the appearance property is no longer in any standard. It was dropped from CSS3 Basic UI.
For IE, you can specifically style the check mark by using the -ms-check pseudo element. If you'd like to just hide the checkmark you can do the following:
input[type="checkbox"]::-ms-check {
color: transparent;
}
If you want to hide the entire element, like what appearance: none; does, you can do:
input[type="checkbox"]::-ms-check {
display: none;
}
To add the check mark back, you should use the :checked pseudo class:
input[type="checkbox"]:checked {
background-color: green;
}
Here is a demo using the latter approach. I've just set the background color when checked, but you can just as easily use an image: http://jsfiddle.net/HxqKu/3/
Related
I'm making my firs steps learning to code. I've been taken some courses on Internet and now I decided to continue learning from the experience while I build a Wordpress child theme.
The thing is that I made a summary. And when it's active it has a blue border.
I'm trying to remove it but I can't find a solution.
I tried suing this without success:
summary:active {
border:none;
}
Do you have some suggestion?
summary:focus{
outline: none;
}
The browser is rendering a border around the summary while it is on focus.
Problem: Its not the border but a outline that browsers render.
Solution: Set outline:none on the element.
So the code would be
summary:focus{
outline: none;
}
To remove it from all inputs
input {
outline: none;
}
To remove it from all tags use the universal selector *:
*:focus {
outline: none;
}
The problem is the input field, not the summary class itself. You can try removing it by using the following code:
input:focus{
outline:none;
}
Hope it helps
People have said to remove with outline: none, which will remove the outline.
However, from an accessibility perspective you should replace the outline with one that fits the brand guidelines.
The outline on an element's focus state is to ensure that someone can tell where they are. Not all users have a point-and-click device, and even if they do, they won't leave their mouse hovering over an element at all times. For field inputs it's worth keeping an outline or other focus style so users know which field they're in.
The A11y Project (accessibility project) has some useful information which covers what I've said.
I'd suggest that rather than doing:
summary:focus {
outline: none !important
}
You talk to the designer to come up a positive focus style, e.g.:
summary:focus {
background: #ffeeee;
color: #242424;
outline: none
}
If it is an input field try this
input:focus{
outline: none !important;
}
I was able to make the blue outline disappear in Safari 10 with:
summary {outline:none;}
Funny thing is that I can't change the specific color of the outline:
summary:focus{outline:red;}
Αlso removed the outline. Using solid and dotted all work as specified, and display it black.
But it looks like the blue color is hard-coded into focused input fields. The very text box I'm using right now has the same light blue outline. Maybe that can't be changed, but you can suppress its visibility or restyle it. You just can't specify a color.
*.no-outline > * :focus {
outline: none;
}
This would remove any the outline for any tag with class no-outline, and also it will remove outline for all its children.
In my application I am showing a graph with legends. Legends have colored checkboxes. Below is code for a checkbox that works fine in IE but the color does not appear in Chrome and Firefox
<input type="checkbox" style="background-color:#d65aef;">
Please tell me what should I do so that it works in IE,Chrome and Firefox. I have to use the hex color as used in the given code.
Form controls like checkbox, radio, select and etc using a platform-native styling based on the operating system's theme. You can reset it by using -moz-appearance and -webkit-appearance properties. But this properties will also reset sizes of control and may be something else, so you will need to add width/height manually:
input[type=checkbox] {
background: red;
-webkit-appearance: none;
-moz-appearance: none;
height: 16px;
width: 16px;
}
Also for checkbox you need to provide a checked state render:
input[type=checkbox]:checked {
background-image: url(/*custom checked icon url*/);
}
Close input into span (or div) and set span color.
<span style="background-color:#d65aef;"><input type="checkbox" class="base" name="w3wp" style="background-color:#d65aef;" value="w3wp" checked="" onclick="legendChanged();" alt="fd" title="w3wp"></span>
I've been noticing that if clicking on a button on my site (as shown in the example below) a gradient border is shown around the button. I've tried several browsers but this only shows in Google Chrome.
Is there a way of removing this CSS wize?
You can disable the outline with outline:none.
input,
select,
textarea,
button {
outline: none;
}
And to stay safe with focus states:
input:focus,
select:focus,
textarea:focus,
button:focus {
outline: none;
}
However, some think it isn't a good idea to disable the outline due to accessibility issues (http://outlinenone.com/)
This is to show that the element is active. To disable this:
#element.focus{
outline:0;
}
I am trying to write a selector like this, but to no success:
.something::after::selection
Basically I am already using ::after to inject some content, namely an image. But I want to prevent the user from being able to "select" this image and get an ugly blue back-shadow.
Normally I can prevent this with the following:
.something::selection
{
background-color: transparent;
}
But it does not seem to combine well with ::after.
Has anyone tried this before or have a solution?
No, in firefox I'm 100% sure that you can't change that effect on selected images, is system-specific, and not customizable yet
*edited
To prevent images to be selected you can use following css:
img {
-o-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
Also see the updated jsfiddle.
With ::after see this jsfiddle.
Is it possible to remove the borders around a checkbox so that it appears invisible? I have it placed in a DIV with a color background.
As this is the first result for me when searching for "remove checkbox border" in Google, let me mention that checkbox default styling could be removed in all browsers except IE with the appearance property:
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
Unfortunately, its not possible to remove borders on browser native checkboxes (it will not work in all browsers), You will have to write your own checkbox-like state widget to implement this. Check out Nice forms if you want to style your regular form controls with custom styling
For FireFox: try border:none.
For IE try: style="background:transparent;border:0"
The other solution is to create your own images for checked and unchecked displaying the appropriate onclick of the image.
I know this is a late answer, but a CSS expert I work with gave me this way to get rid of the border around a checkbox (and probably radio button) in IE10:
Set the border color to the same color as the page's background.
Apply a box-shadow of "none" to it.
That's it. Worked like a charm!
input[type="checkbox"] {
width: 25px;
height: 25px;
background: gray;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
outline: none;
position: relative;
left: -5px;
top: -5px;
cursor: pointer;
}
In CSS this is possible by setting the web kit appearance to none. Something like this
-webkit-appearance: none;
You would have to use some widget or a custom ui of some sort to remove the borders.
I'm not sure if this works: <input type="checkbox" style="border: 0;" />