revision:
When present, it specifies that the element must be filled out before submitting the form.
The "required" attribute can be used on the following elements:<input>, <select>, and <textarea>.
The required attribute is supported by "text", "search", "url", "tel", "email", "password", "date", "month", "week", "time", "datetime-local", "number", "checkbox", "radio", "file", <input> types along with the <select> and <textarea> form control elements.
If present on any of these input types and elements, the ":required" pseudo class will match. If the attribute is not included, the ":optional pseudo class" will match.
<element required></element>
The required attribute specifies that the element must be filled out before submitting the form. This attribute is part of the built-in validation functionality in HTML.
<form style="margin-left:3vw;" action="/action_page.php">
<label for="username">username:</label>
<input type="text" id="username" name="username" required>
<input type="submit">
</form>
The required attribute specifies that the user is required to select a value before submitting the form:
<form style="margin-left:3vw;" action="/action_page.php">
<label for="cars">Choose a car:</label>
<select name="cars" id="cars" required>
<option value="">None</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<br><br>
<input type="submit" value="Submit">
</form>