The onmouseover property allows you to execute a script when the mouse pointer is moved onto an HTML element. Combined with the HTML DOM backgroundColor property, it enables dynamic background color changes to create interactive web pages. Syntax Following is the syntax for the onmouseover property − Content Following is the syntax for changing background color using JavaScript − document.body.style.backgroundColor = "colorValue"; Basic Background Color Change The most common approach is to use the onmouseover event directly on an element to change the entire page background color when hovering. ... Read More
The DOM readyState property returns the loading status of the current HTML document. This property indicates whether the document is still loading, has finished loading, or has completed loading along with all sub-resources like images and stylesheets. Syntax Following is the syntax for the readyState property − document.readyState Return Value The readyState property returns one of three possible string values − "loading" − The document is still loading content. "interactive" − The document has finished loading and parsing, but sub-resources like images may still be loading. "complete" − The document and ... Read More
To send an email using HTML forms, you can use the mailto protocol in the form's action attribute. This method opens the user's default email client with pre-filled information from the form fields. However, this approach has significant limitations and is not recommended for production websites. Syntax Following is the basic syntax for using mailto in HTML forms − The enctype="text/plain" attribute ensures the form data is sent in a readable plain text format rather than URL-encoded format. Basic Email Form Example Following example demonstrates a ... Read More
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 More
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 More
Responsive images automatically adjust to fit different screen sizes and device dimensions. This ensures that images scale appropriately on desktops, tablets, and mobile devices without breaking the layout or becoming too large or small to view properly. To make an image responsive in HTML, we use the tag combined with CSS properties that control the image's width and height behavior. The key is setting the width to scale with the container while maintaining the image's aspect ratio. Syntax Following are the main CSS properties used to make images responsive − width: 100%; height: auto; ... Read More
The reset button is used to reset all the input fields in HTML forms to their initial values. It gets added using the tag with the type="reset" attribute. When clicked, it clears any user-entered data and restores all form elements to their original state. The reset button is particularly useful in long forms where users might want to start over without manually clearing each field. It provides a quick way to undo changes and return to the form's default state. Syntax Following is the syntax for the reset button − The ... Read More
The cols attribute in HTML is used to specify the visible width of a element. It defines how many average character widths the textarea should display horizontally before text wraps to the next line. Syntax Following is the syntax for using the cols attribute − Content Here, number represents the visible width in characters. The default value is typically 20 characters if not specified. Using the cols Attribute The cols attribute accepts a positive integer value that determines the textarea's width. A higher value creates a wider textarea, while a lower ... Read More
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
In Java Swing, the JLabel component by default displays only single-line text. To create a JLabel that can hold multiple lines of text, we need to use HTML formatting within the label text. This allows us to use HTML tags like for line breaks and other HTML formatting elements. Syntax Following is the syntax to create a multiline JLabel using HTML − JLabel label = new JLabel("Line1Line2"); For more complex formatting with alignment − JLabel label = new JLabel("Line1Line2", JLabel.LEFT); How It Works When a JLabel's text starts ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Economics & Finance