From the course: Building Great Forms with HTML and CSS

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

More input attributes

More input attributes

From the course: Building Great Forms with HTML and CSS

Start my 1-month free trial

More input attributes

- [Instructor] As of HTML5, we have some additional attributes that were added to the spec. Let's look at some of those. The first one that we're going to be looking at is autofocus. The autofocus attribute is going to specify that the input field should automatically get focus when the page loads. Autofocus is a Boolean, which means if it's present, it is going to be turned on or working. And if it isn't present, that feature is not going to be functioning in the same way. You can only use autofocus on one element per page. In addition to highlighting that particular field with the focus styles, the blinking insertion point is already ready for us to enter something into that field. The required attribute probably doesn't need much of an introduction. Like autofocus, it does exactly what you expect it to do. By adding it to a form field, the browser is going to require that the user enter data into that field before…

Contents