CSS accent-color
For better or worse, form fields have been somewhat difficult to style with CSS. Form control display is dependent upon device, operating system, and browser, so you can imagine the difficulty in making styling easy. We have slowly been given some controls over form control display, as evidenced by accent-color
!
The accent-color
CSS property allows us to change the accent of input
, input[type=radio]
, and input[type=checkbox]
elements!
input {
accent-color: blue;
}
input[type=checkbox] {
accent-color: red;
}
See the Pen
by David Walsh (@darkwing)
on CodePen.
accent-color
is a lovely addition to input
CSS elements. I love any CSS feature that encourages using native elements instead of shimming your own to improve branding and design. Let's hope for more CSS features like accent-color
!
I get asked loads of questions every day but I'm always surprised that they're rarely questions about code or even tech -- many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes...
When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It." Can you blame us though? We watched the fundamental APIs stagnate for so long that a basic feature...
Many times you'll see a form dynamically change available values based on the value of a form field. For example, a "State" field will change based on which Country a user selects. What annoys me about these forms is that they'll often do an...
Many useful attributes have been provided to web developers recently: download, placeholder, autofocus, and more. One helpful older attribute is the spellcheck attribute which allows developers to control an elements ability to be spell checked or subject to grammar checks. Simple enough, right?
The accent-color CSS property allows us to change the accent of input ….. JUST IN CHROME!
In Safari, FF, – its not working
Check this before: https://caniuse.com/?search=accent-color