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.
One of the worst kept secrets about AJAX on the web is that the underlying API for it, XMLHttpRequest
, wasn't really made for what we've been using it for. We've done well to create elegant APIs around XHR but we know we can do better. Our effort to...
Firefox OS is all over the tech news and for good reason: Mozilla's finally given web developers the platform that they need to create apps the way they've been creating them for years -- with CSS, HTML, and JavaScript. Firefox OS has been rapidly improving...
It's usually best to repair broken image paths as soon as possible because they can damage a website's credibility. And even worse is having a user tell you about it. Using jQuery and PHP, you can have your page automatically notify you of broken...
Before you send your user to an unknown external website, why not provide them a screenshot of the site via a tooltip so they may preview the upcoming page? Here's how you can do just that using MooTools.
The MooTools JavaScript
The first step is to grab...
It’s probably more like
:not(:required)
, right?