HTML中的step屬性用於設置<input>元素的離散步長。數字輸入的默認步進值為1。
用法:它適用於以下輸入類型:數字,範圍,日期,日期時間,月份,時間。
用法:
<input step = "value">
例:
<!DOCTYPE html>
<html>
<head>
<title>HTML step Attribute</title>
<style>
h1,
h2 {
text-align:center;
}
</style>
</head>
<body>
<center>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h2>
HTML step Attribute
</h2>
<input type="number" name="points" step="5"
placeholder="multiples of 5">
</center>
</body>
</html>
輸出:
支持的瀏覽器:下麵列出了step屬性支持的瀏覽器:
- 穀歌瀏覽器6.0
- Internet Explorer 10.0
- Firefox 16.0
- Opera 10.6
- Safari 5.0
相關用法
- HTML <input> step屬性用法及代碼示例
- HTML Input Date step用法及代碼示例
- HTML Input DatetimeLocal step用法及代碼示例
- HTML Input Number step用法及代碼示例
- HTML Input Time step用法及代碼示例
- HTML Input Range step用法及代碼示例
- HTML Input Month step用法及代碼示例
- HTML Input Week step用法及代碼示例
- HTML <html> xmlns屬性用法及代碼示例
- d3.js band.step()用法及代碼示例
- jQuery UI Spinner step用法及代碼示例
- HTML scoped屬性用法及代碼示例
- HTML <th> valign屬性用法及代碼示例
- HTML <col> align屬性用法及代碼示例
- HTML poster屬性用法及代碼示例
- HTML Class屬性用法及代碼示例
- HTML style屬性用法及代碼示例
注:本文由純淨天空篩選整理自Vishal Chaudhary 2大神的英文原創作品 HTML | step Attribute。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。