W3C home > Mailing lists > Public > www-style@w3.org > August 2011

Proposing a syntax for styling form validation messages

From: Peter Gasston <pgasston@gmail.com>
Date: Sun, 14 Aug 2011 10:21:39 +0000
Message-ID: <CAGNZe2W4tWQN_FLyJUfCkUNih3egAHz6sWH0r1m=Mh9-tdhvRg@mail.gmail.com>
To: www-style@w3.org
Forms that are validated in HTML5 display a message if errors are found
during validation . Currently these error messages are given default styles
by the browser, but there will be a requirement for developers to over-rule
those styles. Chrome/WebKit have a way to style these messages (
but their syntax is, in my opinion, not very graceful.

On my blog I've proposed an alternative way to allow this styling, and I'd
appreciate feedback on its practicality from persons more technical than

The approach I'm thinking of would take the form of a pseudo-element,
perhaps something like:

input::error {}

This would allow us to set background, colour and font options. It may be
necessary to also have a property to set where the validation error message
appears in relation to the input itís attached to; perhaps modifying
position with values of *above*, *below*, *before*, or *after*:

input::error { position: below; }

 And, perhaps, another property to set the appearance of the box which
contains the message; perhaps the appearance property with values of
*box*for a rectangle, or
*balloon* for the current speech balloon style:

input::error { appearance: balloon; }

Thereís also the text inside the validation error; the main message, and an
optional extra which can be set with the title attribute (or JavaScript).
These could have further pseudo-elements for finer control over the text

input::error-message { }
input::error-text { }

This is extracted from a fuller post on my blog at
Received on Wednesday, 31 August 2011 17:10:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:03 UTC