當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


HTML step屬性用法及代碼示例

HTML step 屬性為 HTML 文檔中的 <input> 元素定義了一個數字間隔。

用法

以下是語法 -

<input step=”number”>

讓我們看一個 HTML 步驟屬性的例子 -

示例

<!DOCTYPE html>
<html>
<style>
   body {
      color:#000;
      height:100vh;
      background-color:#8BC6EC;
      background-image:linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
      text-align:center;
   }
</style>
<body>
<h1>HTML step Demo</h1>
<p>Enter the number of order:</p>
<input type="number" step="5" value="0">
</body>
</html>

輸出

現在輸入任何數字,然後嘗試使用向上/向下箭頭鍵增加或減少它。

相關用法


注:本文由純淨天空篩選整理自AmitDiwan大神的英文原創作品 HTML step Attribute。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。