Skip to content

Instantly share code, notes, and snippets.

@machal
Created January 29, 2012 16:12
Show Gist options
  • Select an option

  • Save machal/1699466 to your computer and use it in GitHub Desktop.

Select an option

Save machal/1699466 to your computer and use it in GitHub Desktop.
Dabblet: Testing HTML5 input attributes (placeholder, required, pattern)
/**
* Dabblet: Testing HTML5 input attributes (placeholder, required, pattern)
* and CSS3 styling of required
*/
input[required] {
border: 3px solid #333;
}
input[required]:invalid:focus {
background-color: pink;
}
body {
background: #ccc;
}
<form action="#">
<p><input placeholder="Vaše jméno" required>
<p><input placeholder="Vaše domena.cz" required pattern="^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$">
<p><input type="submit">
</form>
{"view":"split","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment