Use the selected attribute to specify that the option should be pre-selected when page loads in HTML. You can try to run the following code to implement selected attribute −Example HTML selected attribute Here's the list of subjects. Select any one: Computer Architecture Java Discrete Mathematics
Use the scoped attribute to specify that the styles only apply to the parent element and the element’s child elements −Example h2 { color:yellow; } h2 { color:grey; } Grey Heading Yellow Heading
The required attribute in HTML is used to specify that the element should be filled before the form is submitted. If the field is not filled and the submit button is clicked, an error generates, which fails form submission. The error will be “Please fill out this field”.The required attribute can be used on input, select and textarea element.ExampleYou can try to run the following code to implement readonly attribute − HTML placeholder attribute Register
Use the rel attribute to see the relationship between the current document and the linked document. It works for , , HTML elements. ExampleYou can try to run the following code to implement rel attribute. The example sets the CSS files − Heading This is demo content.
Use the name attribute to set the name of the element. You can use this with the following HTML elements: , , , , , , , , , , , ExampleYou can try to run the following code to implement name attribute − Subject: Add an incorrect spelling for a word above and see what happens. This is an editable conttent, with a spelling mistake. Click to edit.
Use the muted attribute to set the audio output of the video to mute. You can try to run the following code to implement muted attribute −Example Your browser does not support the video element.
Use the min attribute to add the minimum value in HTML. You can try to run the following code to implement min attribute −Example Rank:
Use the method attribute to specify the HTTP method to use when sending form-data in HTML.ExampleYou can try the following code to implement method attribute − HTML option Tag HTML Ruby
The ondurationchange attribute triggers when the length of the audio/ video changes in HTML.ExampleYou can try to run the following code to implement ondurationchange attribute − Your browser does not support the video element. function display(vLength) { alert("Video Length: " + vLength.duration + " seconds"); }
Use the max attribute to add the maximum value in HTML. You can try to run the following code to implement max attribute − Example Rank: