Web Development Articles

Page 81 of 801

Set the number of columns to span in HTML

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 611 Views

The colspan attribute in HTML allows you to set the number of columns that a table cell should span. This enables a single or element to stretch across multiple columns, similar to the "merge cells" feature in spreadsheet applications like Excel. The colspan attribute is essential for creating complex table layouts where certain cells need to occupy more horizontal space than others, such as headers that span across multiple data columns or summary rows that extend across the entire table width. Syntax Following is the syntax for the colspan attribute − Content Content ...

Read More

How to set the URL of the media file in HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 842 Views

In this article, we are going to learn about how to set the URL of the media file in HTML using the element. This element allows you to specify multiple media sources with different formats, enabling browsers to choose the most suitable format they support. The element is used inside , , and elements to provide alternative media resources. By offering multiple formats, you ensure better cross-browser compatibility and optimal media delivery across different devices and platforms. Syntax Following is the syntax for the element − The src ...

Read More

Execute a script when the user pastes some content in an element in HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 248 Views

In this article, we are going to execute a script when the user pastes content into an element in HTML. The onpaste event is triggered when a user pastes content into an element, making it useful for validation, formatting, or tracking paste operations. Although all HTML elements accept the onpaste event, you cannot actually paste content into elements like or unless they have the contenteditable attribute set to "true". Most commonly, the onpaste event is used with elements of type="text" and elements. Syntax Following is the syntax for using the onpaste event in ...

Read More

Set the language of the track text data in HTML

Abhinanda Shri
Abhinanda Shri
Updated on 16-Mar-2026 202 Views

The srclang attribute in HTML5 is used to specify the language of the track text data. This attribute is essential when working with elements to provide subtitles, captions, descriptions, or other text tracks for multimedia content. The srclang attribute helps browsers and assistive technologies understand what language the track content is written in. Syntax Following is the syntax for the srclang attribute − The language-code should be a valid BCP 47 language tag, such as "en" for English, "es" for Spanish, or "fr" for French. Parameters The srclang attribute accepts ...

Read More

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

Smita Kapse
Smita Kapse
Updated on 16-Mar-2026 386 Views

Use the srcset attribute to specify the URL of the image to use in different situations in HTML. This attribute allows you to provide multiple image sources for responsive images, enabling browsers to choose the most appropriate image based on screen size, resolution, or other conditions. Syntax The srcset attribute can be used in two main ways − Using srcset with img Element The srcset attribute on the element allows you to specify multiple image sources with their respective widths or pixel densities. The browser automatically selects ...

Read More

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

radhakrishna
radhakrishna
Updated on 16-Mar-2026 363 Views

The step attribute in HTML defines the legal number intervals for input fields. It specifies the increment value that users can select, creating a controlled range of acceptable values. The step attribute works with numeric input types like number, range, date, datetime-local, month, time, and week. Syntax Following is the syntax for the step attribute − The value can be a positive number, decimal, or the keyword any. When combined with min and max attributes, it creates a complete range validation system. Step Attribute with Number Input The step attribute controls ...

Read More

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

Nishtha Thakur
Nishtha Thakur
Updated on 16-Mar-2026 219 Views

The onbeforeunload event attribute in HTML fires when the document is about to be unloaded, such as when a user closes the browser tab, navigates away from the page, or refreshes it. This event is commonly used to warn users about unsaved changes or to perform cleanup operations before the page is destroyed. Syntax Following is the syntax for the onbeforeunload event attribute − The event handler function can return a string message that will be displayed in the browser's confirmation dialog. However, modern browsers may show their own generic message instead of ...

Read More

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

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 524 Views

The onhashchange event in HTML executes a script whenever the anchor part (hash fragment) of the URL changes. The anchor part refers to the portion of the URL that comes after the # symbol, commonly used for navigation within a page or single-page applications. This event is particularly useful for detecting when users navigate using the browser's back/forward buttons or when the URL hash is programmatically modified. The hash change can be detected using either the onhashchange attribute or JavaScript event listeners. Syntax Following is the syntax for the onhashchange attribute − ...

Read More

How do we set the type of element in HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 316 Views

In HTML, the type attribute is used to specify the type or behavior of various HTML elements. This attribute is essential for defining how elements should function and what kind of content they handle. The type attribute is commonly used with form elements like and , as well as multimedia and resource elements. The type attribute serves different purposes depending on the element − Form elements − Defines the input type or button behavior Script elements − Specifies the scripting language or MIME type Media elements − Indicates the media format or MIME type Link elements ...

Read More

Execute a script when a file can be played all the way to the end without pausing for buffering in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 126 Views

The oncanplaythrough attribute in HTML5 executes a JavaScript function when a media file (audio or video) can be played all the way through without pausing for buffering. This event fires when the browser estimates that enough data has been loaded to play the media from start to finish at the current playback rate. Syntax Following is the syntax for the oncanplaythrough attribute − The functionName() is a JavaScript function that gets executed when the media can play through without buffering interruptions. How It Works The oncanplaythrough event is part of ...

Read More
Showing 801–810 of 8,010 articles
« Prev 1 79 80 81 82 83 801 Next »
Advertisements