HTML step 属性

htmlweb developmentfront end technology更新于 2024/5/23 7:40:17

HTML step 属性定义 HTML 文档中 <input> 元素的数字间隔。

语法

以下是语法 −

<input step=”number”>

让我们看一个 HTML step 属性的示例 −

示例

<!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>

输出

现在输入任意数字,然后尝试使用向上/向下箭头键增加或减少它。


相关文章


有用资源