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.
Write Better JavaScript with Promises
You’ve probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don’t see what makes them so special. Can’t you just use a callback? What’s the big deal? In this article, we’ll…
9 Mind-Blowing Canvas Demos
The
<canvas>
element has been a revelation for the visual experts among our ranks. Canvas provides the means for incredible and efficient animations with the added bonus of no Flash; these developers can flash their awesome JavaScript skills instead. Here are nine unbelievable canvas demos that…
Image Reflections with CSS
Image reflection is a great way to subtly spice up an image. The first method of creating these reflections was baking them right into the images themselves. Within the past few years, we’ve introduced JavaScript strategies and CANVAS alternatives to achieve image reflections without…
Source link