Found 2416 Articles for HTML

How to add the height of the element in HTML?

Krantik Chavan
Updated on 24-Jun-2020 08:25:38

86 Views

Use the height attribute in HTML to set the height of an element. You can use the attribute with the following elements − , , , , , etc.ExampleYou can try to run the following code to implement height attribute in HTML −                                        Your browser does not support the video element.          

How to create a context menu for an element in HTML5?

Ramu Prasad
Updated on 03-Mar-2020 05:36:48

402 Views

Use the contextmenu attribute in HTML5 to create a context menu for an element. A context menu generates when a user right-clicks. ExampleYou can try to run the following code to create a context menu −           HTML menuitem Tag                        Right click inside here....                                                                              

How do we embed custom data attributes on all HTML elements?

Nikhilesh Aleti
Updated on 08-Nov-2022 08:02:07

447 Views

In this article, we need to embed custom data attributes on all HTML elements. we can do so, using the data-* attribute in HTML. The data-* attribute in HTML is used to custom data private to the webpage or application. This attribute adds custom values to an HTML element. The data-* attribute in HTML consists of two parts − The attribute value can be any string. The attribute name should only contain lowercase letters and must have at least one character after the prefix "data-". This data is commonly used in JavaScript to improve the user experience. Following ... Read More

Execute a script when a user is pressing a key in HTML?

Chandu yadav
Updated on 03-Mar-2020 05:36:03

264 Views

Use the onkeydown attribute. The onkeydown attribute triggers when the user is pressing a key.ExampleYou can try to run the following code to execute a script on pressing a key −           Press a key inside the textbox.                      function display() {             alert("You pressed a key!");          }          

How to specify whether the form-data should be encoded while submitting to the server with HTML?

radhakrishna
Updated on 03-Mar-2020 05:34:29

136 Views

Use enctype attribute in HTML to set whether the form-data should be encoded while submitting to the server.ExampleYou can try to run the following code to implement enctype attribute −           Which sports do you like?                 Football           Cricket           Hockey                    

How to set whether the dragged data is copied, moved, or linked, when dropped in HTML?

Ankith Reddy
Updated on 29-May-2020 22:12:50

45 Views

Use the dropzone attribute to set whether the dragged data is copied, moved or linked.Copy − The drop will create a copy of the dragged element.Move − The dragged element will get moved to the new location.Link − It creates a link to the dragged data       Try the following to work with dropzone attribute in JavaScript − None of the browsers supports this attribute now.

How to set whether an element is draggable or not in HTML?

Jennifer Nicholas
Updated on 03-Mar-2020 05:32:47

467 Views

Use the draggable attribute to set whether the element is draggable or not. Set it using the values true and false.ExampleYou can try to run the following code to implement draggable element and drag an element −                 .drag {          float: left;          width: 100px;          height: 35px;          border: 2px dashed #876587;          margin: 15px;          padding: 10px;       }                     ... Read More

How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML?

Nikitha N
Updated on 03-Mar-2020 05:32:06

104 Views

Use the download attribute to set the file to download on click of the hyperlink. Set the value of the attribute to the name of the downloaded file, for example, image.Example           if statement in Java       The following is an image explaining the concept if if-statmement in Java (Click to download):                                

How do we set the text direction for the content in an element in HTML?

Arjun Thakur
Updated on 03-Mar-2020 05:29:57

152 Views

Use the dir attribute in HTML, to set the text direction for the content in an element. You can try to run the following code to implement dir attribute −Example           This is demo text from left-to-right.       This is demo text from right-to-left.    

How to set that the specified element/group of elements should be disabled in HTML?

vanithasree
Updated on 24-Jun-2020 08:26:38

67 Views

Use the disabled attribute to disable an element. The attribute can be used for the following elements: , , , , etc.ExampleYou can try to run the following code to implement disabled attribute −           Which sports do you like?                 Football           Cricket           Hockey                    

Advertisements