CSS :optional
A decade ago HTML and CSS added the ability to, at least signal, validation of form fields. The required
attribute helped inform users which fields were required, while pattern
allowed developers to provide a regular expression to match against an <input>
's value. Targeting required fields and validation values with just CSS and HTML was very useful.
Did you know that CSS provides :optional
to allow you to style form elements that aren't required?
input:optional, select:optional, textarea:optional {
border: 1px solid #eee;
}
[required] {
border: 1px solid red;
}
In a sense, it feels like :optional
represents :not([required])
, but :optional
is limited to just form fields.
I love almost every part of being a tech blogger: learning, preaching, bantering, researching. The one part about blogging that I absolutely loathe: dealing with SPAM comments. For the past two years, my blog has registered 8,000+ SPAM comments per day. PER DAY. Bloating my database...
Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API...
There's nothing worse than having to click every checkbox in a list. Why not allow users to click one item and every checkbox becomes checked? Here's how to do just that with MooTools 1.2.
The XHTML
Note the image with the ucuc ID -- that...
One device and app feature I've come to appreciate is the ability to change between light and dark modes. If you've ever done late night coding or reading, you know how amazing a dark theme can be for preventing eye strain and the headaches that result.
It’s probably more like
:not(:required)
, right?