HTML Articles

Page 75 of 151

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

vanithasree
vanithasree
Updated on 16-Mar-2026 156 Views

The disabled attribute in HTML is used to make form elements non-interactive and prevent user input or interaction. When an element is disabled, it appears grayed out, cannot receive focus, and its value is not submitted with the form data. Syntax Following is the syntax for the disabled attribute − Or with a value − The disabled attribute is a boolean attribute, meaning its presence alone indicates the element is disabled, regardless of its value. Supported Elements The disabled attribute can be applied to the following ...

Read More

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

Nikitha N
Nikitha N
Updated on 16-Mar-2026 209 Views

The download attribute in HTML specifies that the target will be downloaded when a user clicks on the hyperlink, rather than navigating to the linked resource. This attribute transforms any link into a download trigger, allowing users to save files directly to their device. Syntax Following is the syntax for the download attribute − Link Text You can also specify a filename for the downloaded file − Link Text Parameters The download attribute accepts the following values − Empty value − download without a value uses the ...

Read More

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

Ankith Reddy
Ankith Reddy
Updated on 16-Mar-2026 122 Views

The dropzone attribute in HTML5 was designed to specify how dragged data should be handled when dropped on an element. It defines whether the dropped data should be copied, moved, or linked to its original location. Syntax Following is the syntax for the dropzone attribute − Parameters The dropzone attribute accepts the following values − copy − The drop will create a copy of the dragged element at the target location. move − The dragged element will be moved from its original location to the new target location. link − ...

Read More

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

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 405 Views

The onkeydown attribute in HTML triggers when a user presses a key down. This event fires immediately when a key is pressed, before the key is released. It is commonly used for real-time keyboard interaction, game controls, and form validation. Syntax Following is the syntax for the onkeydown attribute − The function() represents the JavaScript function to execute when the key is pressed down. Basic Key Press Detection Example Following example demonstrates basic key press detection using the onkeydown attribute − Basic ...

Read More

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

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 16-Mar-2026 654 Views

Custom data attributes in HTML allow you to embed custom data private to your webpage or application. The data-* attribute adds custom values to any HTML element without interfering with the standard HTML structure or validation. Data attributes are commonly used to store extra information that can be accessed later via JavaScript for enhanced user interactions, configurations, or metadata storage. Syntax Following is the syntax for using custom data attributes − Content The data-* attribute consists of two parts − Attribute name − Must start with "data-" followed by at ...

Read More

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

Ramu Prasad
Ramu Prasad
Updated on 16-Mar-2026 598 Views

The contextmenu attribute in HTML5 was designed to create custom context menus for elements that appear when a user right-clicks. However, this feature has been deprecated and removed from modern browsers due to security and usability concerns. Syntax The original syntax for the contextmenu attribute was − Content Where menu-id is the ID of the associated element with type="context". Original HTML5 Implementation (Deprecated) The contextmenu attribute was intended to work with the and elements to create custom right-click menus. ...

Read More

Create a draggable paragraph in HTML5

Nancy Den
Nancy Den
Updated on 16-Mar-2026 540 Views

The draggable attribute in HTML5 allows you to make elements draggable by the user. When set to true, elements can be dragged and dropped using mouse interactions. This feature is commonly used for creating interactive user interfaces, sortable lists, and drag-and-drop file uploads. Syntax Following is the syntax for the draggable attribute − Content The draggable attribute accepts the following values − true − The element can be dragged false − The element cannot be dragged auto − Uses the browser's default behavior Basic Draggable Paragraph To create a ...

Read More

Create a hidden paragraph in HTML5

varun
varun
Updated on 16-Mar-2026 2K+ Views

The hidden attribute in HTML5 is used to create elements that are not displayed or relevant to the current page state. When applied to a paragraph or any HTML element, it completely hides the content from both visual display and screen readers, making it semantically irrelevant until the attribute is removed. Syntax Following is the syntax for using the hidden attribute − This paragraph is hidden The hidden attribute is a boolean attribute, meaning its presence alone indicates the element should be hidden. You can also write it as hidden="hidden" or hidden="true", but simply ...

Read More

Create a paragraph with a right-to-left direction in HTML5

Arjun Thakur
Arjun Thakur
Updated on 16-Mar-2026 387 Views

The dir attribute in HTML sets the text direction for an element's content. To create a paragraph with right-to-left direction, use dir="rtl" on the paragraph element. This is particularly useful for languages like Arabic, Hebrew, Persian, and Urdu that are naturally written from right to left. Syntax Following is the syntax for creating a right-to-left paragraph using the dir attribute − Your text content here The dir attribute accepts three values − rtl − Sets text direction from right to left ltr − Sets text direction from left to right (default) auto ...

Read More

How to add multi-language content in HTML?

Prabhas
Prabhas
Updated on 16-Mar-2026 4K+ Views

The lang attribute in HTML allows you to specify the language of content within elements, enabling proper rendering, accessibility, and search engine optimization for multi-language websites. This attribute helps browsers, screen readers, and translation tools understand and process content correctly. Syntax Following is the syntax for the lang attribute − Content The language code follows the ISO 639-1 standard (two-letter codes like en, fr, es) or BCP 47 standard for more specific regional variants (like en-US, fr-CA). Document-Level Language Declaration The most important use of the lang attribute is declaring the primary ...

Read More
Showing 741–750 of 1,509 articles
« Prev 1 73 74 75 76 77 151 Next »
Advertisements