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
Articles on Trending Technologies
Technical articles with clear explanations and examples
HTML type Attribute
The type attribute of the element specifies the MIME (Multipurpose Internet Mail Extensions) type of the linked resource. This attribute provides a hint to the browser about what type of content to expect when the user clicks on the area, helping optimize the user experience. Syntax Following is the syntax for the type attribute − Where media_type is a valid MIME type such as image/png, text/html, application/pdf, etc. Common MIME Types Following are some commonly used MIME types with the area element − MIME Type Description ...
Read MoreHow 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 preselect a value in a dropdown list of items in HTML forms?
With HTML, you can easily create a simple dropdown list of items to get user input in HTML forms. A select box, also called a dropdown box, provides an option to list down various options in the form of a dropdown list. You can also preselect a value in dropdown list of items in HTML forms. For that, add the selected attribute in the tag for the value you want to preselect. Syntax Following is the syntax to preselect an option in a dropdown list − Option 1 ...
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 MoreHTML DOM PageTransition Event
The DOM PageTransitionEvent is fired when a user navigates to or away from a webpage. This event provides information about whether the page was loaded from the browser's cache (back-forward cache) or fetched fresh from the server. The PageTransitionEvent is particularly useful for detecting when pages are restored from the browser's cache, which can affect the state of JavaScript variables and DOM elements. Syntax Following is the syntax for adding PageTransitionEvent listeners − window.addEventListener('pageshow', function(event) { // Handle pageshow event }); window.addEventListener('pagehide', function(event) { // Handle pagehide event ...
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 MoreHow to create table header in HTML?
To create table headers in HTML, use the tag. Table headers are placed within table rows and define column or row headings. The element automatically displays text in bold and center-aligned by default, making it visually distinct from regular table data cells. Table headers serve multiple purposes − they provide semantic meaning for screen readers, can be styled differently with CSS, and help organize data in a structured format. Headers can be placed at the top of columns, beginning of rows, or both depending on your table structure. Syntax Following is the syntax to ...
Read More