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
Front End Technology Articles
Page 71 of 652
How to specify that the element should automatically get focus when the page loads in HTML?
The autofocus attribute in HTML is used to specify that an element should automatically receive focus when the page loads. This eliminates the need for users to manually click on the element before interacting with it, improving user experience and accessibility. Syntax Following is the syntax for using the autofocus attribute − Click Me The autofocus attribute is a boolean attribute, meaning it doesn't require a value. Its mere presence on an element indicates that the element should receive focus automatically. Supported Elements The autofocus attribute can be used with ...
Read MoreHow do we display the thickness of the border of an element in HTML?
The border thickness in HTML elements can be controlled using CSS properties. While the legacy border attribute was used in older HTML versions for tables, it has been deprecated in HTML5. The modern approach uses CSS border-width, border-style, and border-color properties to define border appearance and thickness. Syntax Following is the syntax for setting border thickness using CSS − border-width: value; border: width style color; Where value can be specified in pixels (px), ems (em), or keywords like thin, medium, and thick. Using CSS Border Properties The CSS border-width property controls the ...
Read MoreHow to display a URL which explains the quote/deleted/inserted text in HTML?
The cite attribute in HTML is used to specify a URL that explains the reason for quoting, deleting, or inserting text. This attribute provides additional context and reference information for the content, making it more accessible and informative for both users and search engines. Syntax Following is the syntax for the cite attribute − quoted text quoted content deleted text inserted text The cite attribute accepts a valid URL that points to a source document explaining the quote, deletion, or insertion. Elements That Support the Cite Attribute The cite attribute can be ...
Read MoreHow to change the text color of an element in HTML?
In HTML, you can change the text color of an element using several methods. While the deprecated tag with the color attribute was used in older HTML versions, modern HTML5 uses CSS for styling text colors through inline styles, internal stylesheets, or external CSS files. Note − The tag and its color attribute are not supported in HTML5 and should be avoided in favor of CSS styling methods. CSS color Property Syntax Following is the syntax for changing text color using CSS − color: value; The value can be specified in ...
Read MoreHow to execute the script when the page has finished parsing in HTML?
The defer attribute in HTML allows scripts to execute only after the HTML document has been completely parsed. This ensures that the script runs when the DOM is ready but before the DOMContentLoaded event fires. Syntax Following is the syntax for using the defer attribute − The defer attribute is a boolean attribute that only works with external scripts (scripts with a src attribute). It has no effect on inline scripts. How the Defer Attribute Works When the browser encounters a script with the defer attribute, it downloads the script in ...
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 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 More