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 74 of 151
How to include an alternate text when the original element fails to display in HTML?
The alt attribute provides alternative text for images when they cannot be displayed due to loading issues, broken links, or slow connections. This attribute is essential for accessibility, helping screen readers describe images to visually impaired users, and improves SEO by providing context to search engines. Syntax Following is the syntax for the alt attribute − The alt attribute accepts a text string that describes the image content or function. Keep the description concise but meaningful. Basic Alt Attribute Usage Example Following example shows how to use the alt attribute ...
Read MoreHow do we set the alignment according to surrounding elements in HTML?
The align attribute was used in older HTML versions to set the alignment of elements according to their surrounding content. However, this attribute is deprecated in HTML5, and CSS should be used instead for modern web development. Note − The align attribute is deprecated in HTML5. Use CSS text-align, margin, or flexbox properties for alignment instead. Legacy Align Attribute Syntax The deprecated align attribute had the following syntax − Content Where value could be: left − Aligns content to the left right − Aligns content to the right center − Centers ...
Read MoreHow to specify where to send the form-data when a form is submitted in HTML?
The action attribute in HTML forms specifies where to send the form data when the form is submitted. This attribute defines the destination URL, file path, or email address that will process the submitted form data. Syntax Following is the syntax for the action attribute − Where destination can be a URL, file path, or email address, and method_type is typically GET or POST. Common Action Attribute Values The action attribute accepts different types of destinations − Server URL − Points to a server-side ...
Read MoreHow to set the script to be executed asynchronously in HTML?
The async attribute in HTML allows external JavaScript files to execute asynchronously, meaning the script runs as soon as it finishes downloading without blocking the HTML parsing. This improves page loading performance by preventing scripts from delaying the rendering of other page content. Syntax Following is the syntax for using the async attribute − The async attribute is a boolean attribute that only works with external scripts (scripts with a src attribute). It cannot be used with inline scripts. How Async Scripts Work When a browser encounters a tag with ...
Read MoreHow to specify whether the or the element should have autocomplete enabled in HTML?
The autocomplete attribute in HTML controls whether the browser should automatically suggest previously entered values for form fields. This feature helps users fill forms more efficiently by displaying a dropdown of suggested values based on their input history. Syntax Following is the syntax for the autocomplete attribute on the element − Following is the syntax for the autocomplete attribute on the element − Autocomplete Values The autocomplete attribute accepts the following values − Value Description ...
Read MoreHow 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 More