Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
HTML Articles
Page 75 of 151
How to set that the specified element/group of elements should be disabled in HTML?
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 MoreHow to specify that the target will be downloaded when a user clicks on the hyperlink in HTML?
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 MoreHow to set whether the dragged data is copied, moved, or linked, when dropped in HTML?
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 MoreExecute a script when a user is pressing a key in HTML?
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 MoreHow do we embed custom data attributes on all HTML elements?
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 MoreHow to create a context menu for an element in HTML5?
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 MoreCreate a draggable paragraph in HTML5
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 MoreCreate a hidden paragraph in HTML5
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 MoreCreate a paragraph with a right-to-left direction in HTML5
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 MoreHow to add multi-language content in HTML?
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