x
 
<!DOCTYPE html>
<html>
<body>
<h1>input pattern 属性</h1>
<p>下面是包含电子邮件字段的表单,该字段必须遵循以下顺序:characters@characters.domain(字符后跟 @ 符号,然后是更多字符,然后是“.”。在“.”符号之后,至少添加从 a 到 z 的 2 个字母:</p>
<form action="/demo/action_page.php">
  <label for="email">电子邮件:</label>
  <input type="email" id="email" name="email" pattern="[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,}$">
  <input type="submit">
</form>
</body>
</html>