Bradley Taunt

You should be using date & time inputs

Jun 22, 2017

By doing the following, you instantly add support for date and time pickers on all (well mostly all) devices and operating systems:

See the Pen Default date/time input types (placeholder visible) by Bradley Taunt (@bradleytaunt) on CodePen.

One small caveat

The one issue you may notice with this approach is that the input placeholder attributes are no longer visible. This is sad indeed. Thankfully there is a workaround!

h3 { margin-left: 10px; }

input {
    color: transparent;
    display: block;
    margin: 10px;
    padding: 10px;
}

input:invalid:before {
    color: grey;
    content: attr(placeholder);
    padding-left: 10px;
    pointer-events: none;
    position: absolute;
    left: 20px;
}

input:valid, input:focus, input:active {
    color: black;
}

input:before {
    display: none;
}

Other Articles

ET-Jekyll theme Jan 14, 2018

Free device mockups Jan 10, 2018

Fresh coat of paint Jan 9, 2018

2017 - year in review Jan 1, 2018

Try getting into a routine Dec 20, 2017

Chasing performance Nov 20, 2017

The death of personality: the flat design system Nov 1, 2017

Unsolicited design review - Dropbox Oct 10, 2017

Goodbye CSS preprocessors Aug 7, 2017

Designers need thicker skin Jul 10, 2017

You should be using date & time inputs Jun 22, 2017

The wonders of text ellipsis Nov 15, 2016