Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

HTML5新要素 input type="time"

概要

input type="time"タグについて説明します。

内容

input type="time"は時間の入力欄です。

属性として以下の利用が可能です
max = 最大値を設定
min = 最小値を設定
step = 秒単位でのステップ幅を設定

サンプル

<!DOCTYPE HTML>
<html lang="ja-JP">
  <head>
    <meta charset="UTF-8" />
    <title>input type="time"</title>
  </head>
  <body>
  <form action="">
    time:<input type="time" name="time" id="time" value="" max="" min="" style="width:200px;" required step="30" />
    <input type="submit" name="" value="submit" />
  </form>
  </body>
</html>

完成画面のキャプチャ

現状だと、Opera以外はテキストボックスと変わらない表示なのでOperaのキャプチャです。