Found 2202 Articles for HTML

How do we set the type of element in HTML?

Yaswanth Varma
Updated on 16-Dec-2022 10:37:00

211 Views

In this article, we are going to learn about how do we set the type of element in HTML as we are familiar with type in HTML. For elements, the HTML type Attribute is used to define the type of button. The type of input to display is also specified using it in the element. The Internet Media Type is used for embed elements including link, object, script, source, and style. Let’s dive one by one into the examples. The type attribute can be used to the following elements Element Attribute type ... Read More

How to specify whether the content of an element should be translated or not in HTML?

Krantik Chavan
Updated on 01-Jun-2020 09:25:06

146 Views

The translate attribute is useful to set that the content of an element is to be translated or not.The following are the attributes −AttributeValueDescriptionYesThe content should be translated.NoThe content should not be translated.If you did not want a specific word to be translated, then add it to the translate attribute −This won’t get translated.

Execute a script when there have been changes to the anchor part of the URL in HTML?

Yaswanth Varma
Updated on 16-Dec-2022 10:32:12

433 Views

In this article we are going to learn about execute a script when there have been changes to the anchor part of the URL in HTML. The onhashchange attribute in HTML definition states that it activates once the anchor portion of the current URL has changed. The present URL's '#' sign introduces the anchor portion. A single value script for this attribute executes when the onhashchange event attribute is activated. This attribute only applies to the tag. Let’s dive into the following examples to understand more about executing a script when there have been changes to the anchor part ... Read More

How do we specify the target for where to open the linked document in HTML?

vanithasree
Updated on 01-Jun-2020 09:26:06

195 Views

Use the target attribute to specify the target for where to open the linked document in HTML. Here are the values of the target attribute −AttributeDescription_blankOpens the linked page in a new tab.selfOpens the linked page in the current tab.parentOpens the linked page in a parent frame.topOpens the linked page in the topmost frame.ExampleYou can try to run the following code to implement target attribute −           HTML target attribute               References       Refer the following website.          The above link will open in a new tab.    

Execute a script when the document is about to be unloaded in HTML?

Nishtha Thakur
Updated on 03-Mar-2020 12:20:33

163 Views

The onbeforeunload event attribute’ fires when the document is ready to be unloaded.ExampleYou can try to run the following code to implement the onbeforeunload attribute −           Close this window or press F5.                function display() {             return "Wanna stay here or leave?";          }          

Execute a script before the document is printed in HTML?

Yaswanth Varma
Updated on 16-Dec-2022 10:25:32

330 Views

The task we are going to perform in this article is execute a script before the document is printed in HTML. When a page is about to be printed, the HTML onbeforeprint attribute is used. And before the print dialogue box appears, the alert message is displayed. Together with the onafterprint attribute, the onbeforeprint attribute is utilised. This is a part of event attribute. Let’s dive into the following examples to understand more about to execute a script before the document is printed in HTML. Example 1 In the following examples we are using HTML onbeforeprint attribute. ... Read More

How do we include the legal number intervals for an input field in HTML?

radhakrishna
Updated on 03-Mar-2020 11:23:06

305 Views

Use the step attribute to include the legal number intervals for an input field in HTML. The HTML input type step attribute sets the legal number intervals. Steps are number steps like 0, 5, 10, 15, 20, etc. The step attribute can be used together with the max and min attributes to create a range of legal values.ExampleYou can try to run the following code to implement step attribute −           HTML input step attribute                                            

How to specify the URL of the image to use in different situations in HTML?

Smita Kapse
Updated on 03-Mar-2020 11:25:00

330 Views

Use the srcset attribute to specify the URL of the image to use in different situations in HTML.ExampleYou can try to run the following code to implement srcset attribute. Resize the browser to see different images loading −                                                                

Set the language of the track text data in HTML

Abhinanda Shri
Updated on 03-Mar-2020 11:25:44

162 Views

Use the srclang attribute to set the language of the track text data in HTML. For subtitles, use this attribute.ExampleYou can try to run the following code to implement srlang attribute −                                                            Your browser does not support the video element.          

Set the start value of an ordered list in HTML?

mkotla
Updated on 03-Mar-2020 11:24:10

462 Views

Use the start attribute to set the start value of an ordered list in HTML i.e.Add the value of where you want to start above.ExampleYou can try to run the following code to implement the start attribute −           HTML ol Tag               Programming Languages Rank Usage:                Java          C++          C          

Advertisements