- HTML Tutorial
- HTML - Home
- HTML - Introduction
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Headings
- HTML - Paragraphs
- HTML - Fonts
- HTML - Blocks
- HTML - Style Sheet
- HTML - Formatting
- HTML - Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - step Attribute
HTML step attribute is used to set the interval between legal numbers or the distinct step size.
The step sets the stepping interval when clicking up and down spinner buttons, moving a slider left and right on a range, and validating the different data types. If not explicitly included, then the default value is set to 1 for number and range. The default stepping value for time is 1 second, with 900 begin equal to 15 minutes. For example; if step = "3", legal number could be -3, 0, 3, 6, etc.
Note: The step attribute works with the following input types: number, range, date, datetime-local, month, time, and week. And this attribute can be used together with the max and min attributes to create a range of legal values.
Syntax
<input step = "value" >
Applies on
The below-listed elements allow the use of the HTML step attribute.
Element | Description |
---|---|
<input> | HTML <input> tag is used to specify the input field. |
Examples of HTML step Attribute
Bellow examples will illustrate the HTML step attribute, where and how we should use this attribute!
Define interval step with Numbers
In the following example we have created a input field where we can increase or decrease the number, but as we set the step="5"
, it will use 5 as an interval.
<!DOCTYPE html> <html> <head> <title>HTML step Attribute</title> </head> <body> <h2>HTML step Attribute</h2> <input type="number" name="tp" step="5" placeholder="multiples of 5"> </body> </html>
Disable Specific Months using step Attribute
In the below code, the output window will display the input field applied with step attribute by 2 on the input type=month
so the even months will be disabled.
<!DOCTYPE html> <html> <head> <title>HTML step Attribute</title> </head> <body> <h2>HTML step Attribute</h2> <input type="month" name="month" step="2" placeholder="Month will step by 2"> </body> </html>
Supported Browsers
Attribute | |||||
---|---|---|---|---|---|
step | 6.0 | 10.0 | 16.0 | 5.0 | 10.6 |
To Continue Learning Please Login
Login with Google