To use a floating image in HTML, use the CSS float property. It allows you to position an image to the left or right side of its container, causing surrounding text to wrap around the image naturally. Syntax Following is the syntax for the CSS float property − img { float: value; } Alternatively, you can apply it inline − Float Property Values The float property accepts the following values − Property Value Description none Default value. ... Read More
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 More
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
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 More
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
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 More
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
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
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
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
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Economics & Finance