I have a strange issue and I am not sure where to look for a fix. Googling is not leading to any answers.
I have some CSS to make the selected radio button purple. Easy right? However, it is blue. Even though the CSS is clearly in the inspector as purple. Even trying to force style in the browser just to change it doesn't work. Why would this be? I've never seen where it clearly is using the right CSS but not actually rendering. This is happening on multiple browsers.
My code is in Elementor:
selector input[type="radio"]:checked, input[type=reset], input[type="checkbox"]:checked, input[type="checkbox"]:hover:checked, input[type="checkbox"]:focus:checked, input[type=range]::-webkit-slider-thumb {
border-color: #9710A6 !important;
background-color: #9710A6 !important;
box-shadow: none;
}
Which shows up perfectly in the inspector:
.elementor-1202 .elementor-element.elementor-element-f11e2ef input[type="radio"]:checked, input[type=reset], input[type="checkbox"]:checked, input[type="checkbox"]:hover:checked, input[type="checkbox"]:focus:checked, input[type=range]::-webkit-slider-thumb {
border-color: #9710A6 !important;
background-color: #9710A6 !important;
box-shadow: none;
}
And shows as what is being computed in console.
background-color
rgb(151, 16, 166)
#9710A6 !important.elementor-1202 .elementor-element.elementor-element-f11e2ef input[type="radio"]:checked, input[type=reset], input[type="checkbox"]:checked, input[type="checkbox"]:hover:checked, input[type="checkbox"]:focus:checked, input[type=range]::-webkit-slider-thumb
And yet when I look at it is is blue. Using a color selecting tool it returns:
0075FF - I think it is the default browser blue.
Is there a way to have maybe some JS running or something changing it that would not show up in the console? If it was JS changing it wouldn't the result "computed" value change?
So strange, any ideas or help you can offer would be really appreciated. Thanks so much!
Thanks to Carlton Lindsay for the answer.
It appears you cannot change the radio button directly with CSS. Instead, hide the default button and create a new one using :before to add one back in it's place.
This seems like really strange way to do it. But it is how it is done for now. Hopefully things change soon in the browsers so you can directly manipulate the style through CSS.
Related
About the problem:
The link is the inVision design of an input element with custom css styles.
As you can see, its border is removed except the bottom line and the cursor/blinker looks pretty thick.
Here's what I have done so far.
<input class="custom-input" />
.custom-class {
border: none;
border-bottom: #eee solid 3px;
line-height: 2;
font-size: 36px;
text-align: center;
caret-color: #231F20;
}
What is missing so far is that the blinker is still an ordinary one.
I have gone through research to find answers. There are a bunch of articles and StackOverflow answers for caret-color but none of them answers how to change the thickness of it.
Also, there is a codepen demo for using a span element by enabling the content to be editable.
But my question is "Is there a solution with only css styles after all the days of evolution in modern css?"
Thanks in advance.
PS. I am not looking for caret-color property solutions. I am talking about the thickness of the blinker specifically.
I don't know if you can modify the text caret thickness (I only see one related property), but you can change its color with caret-color.
There seems to be some ways to change the caret thickness using OS tools, but none in css for the moment.
Edit: There is another way to customize the caret: use js to create a new caret above the classic one (src -> link, src2 -> link2 (jQuery plugin)).
I forked a codepen, and I think you can use the "cutom caret" to hide the authentic one :)
This is a learning exercise for me, so thanks in advance for not telling me why I don't want to do to the following. I don't want to do, I want to understand.
Given the following CSS:
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
input[type="checkbox"]:focus {
outline: none;
}
The specificity for both shows as 0,2,1, and everything I read about CSS says the second style should override the first as it comes last. If I get more specific about the second style, it wins. But as posted, Chrome doesn't display the outline, but IE11 and FF28 do. This seems to me to be such a fundamentally simple application of CSS. Does anyone have any insight into what the underlying issue is, so that I can pull it into my thinking as I'm developing stylesheets?
EDIT: Chrome also doesn't display the outline if I delete the second style. In Chrome, the outline: thin dotted are overridden by the following outline line. So it appears that per the spec, Chrome is playing by the book and FF and IE don't? Could it be a union vs. override difference in how browsers interpret CSS?
With apologies, the error was mine. When I switched from bootstrap.min.css to bootstrap.less, I didn't remove the former from loading so it was loaded last and overrode my Site.less -> site.css. I figured it out after I tried to create a fiddle, which I should have done in the first place. Feel free to down-mod this post to hell in the way that it deserves.
I have really simple HTML code
<img class='star' src='' alt='★'/>
With really simple style
.star {
position: absolute;
cursor: pointer;
font-size: 40px;
color: black;
}
.star:hover {
color:red;
}
My idia is this. If there is no image on server, I show unicode star symbol ( or if user will switch off all images ). And if a user
It works perfectly in FF ( tested on FF25 ) but fails really hard on WebKit browsers. Hover state dosn't trigger or triggers ones and then stay in that state forever.
I have only one question.. WTF is that? o_O Where am I wrong, or it's just a WebKit bug?
It would be nice if someone told me how to fix this. But mostly i want to understand what is going on here.
PS: Example http://jsbin.com/UMIrAJI/3/edit
UPD:
This example is working http://jsbin.com/UMIrAJI/5/edit but the only difference is 'background' color changed on hover. As soon as we remove 'background' - hover stops working. LOL.
So my question is still valid. What is going on here?
UPD2:
I found another workaround. If we add border: 0px solid white; (but only on hover) example will also start to work http://jsbin.com/UMIrAJI/6/edit . So it's something about repainting.
UPD3:
It looks like a bug to me so I reported it. I'll wait for some comments from developers.
https://code.google.com/p/chromium/issues/detail?id=323545&thanks=323545&ts=1385479799
Instead of alt, which should describe the content of the image, for browsers without image support and for accessibility tools, use the title property
<img class='star' src='' title='★'/>
I have an <object> in my page code and my background color is not white. The object is created with a white border, which I don't want.
Any ideas on how to make it border: 0px; or border-color: #whatever;? Neither of those work. Can someone help me figure this out. Thanks
You're probably seeing an outline rule. This CSS should remove it:
object {
border: none !important;
outline: none !important;
}
You should probably get rid of the !important tags once you make sure that works.
When debugging something in the browser, you should be able to see what styles are set within the browser console. In Chrome, for example, you can right click on an element and it will show you exactly what styles are being applied to any given DOM element.
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;
}