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
Changing three.js background to transparent or another color in HTML
In three.js, you can customize the background of your scene by making it transparent or setting it to a specific color. This is achieved through the WebGLRenderer configuration and the setClearColor method. Syntax Following is the syntax for creating a transparent background − var renderer = new THREE.WebGLRenderer({ alpha: true }); renderer.setClearColor(0x000000, 0); Following is the syntax for setting a background color − renderer.setClearColor(colorHex, alpha); Parameters The setClearColor method accepts the following parameters − colorHex − A hexadecimal color value (e.g., 0xff0000 for red) alpha − Opacity ...
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 clear all the input in HTML forms?
Using HTML forms, you can easily take user input. The tag is used to get user input by adding form elements. Different types of form elements include text input, radio button input, submit button, etc. To clear all the input in an HTML form, you have several methods available. The most common approaches include using the reset input type, JavaScript's getElementById() method, or direct onclick events. Each method serves different scenarios depending on whether you want to clear individual fields or all form data at once. Method 1 − Using JavaScript getElementById() The getElementById() method allows ...
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 MoreWhat are the MessageChannel and MessagePort Objects in HTML5?
The MessageChannel and MessagePort objects in HTML5 provide a powerful way to enable secure, bidirectional communication between different browsing contexts such as iframes, web workers, or different windows. When a MessageChannel is created, it internally generates two connected ports that can send data back and forth between separate execution contexts. MessageChannel Object The MessageChannel creates a communication channel with two MessagePort objects. It acts as a pipe that connects two separate browsing contexts, allowing them to exchange messages securely. Syntax var channel = new MessageChannel(); MessagePort Object Each MessageChannel contains two MessagePort ...
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 specify that the audio/video will start playing as soon as it is ready in HTML?
The autoplay attribute in HTML specifies that audio or video content should start playing automatically as soon as it is ready, without requiring user interaction. This attribute is a boolean attribute that can be applied to both and elements. Syntax Following is the syntax for the autoplay attribute − ... ... The autoplay attribute can also be written with an explicit value − ... Video Autoplay Example Following example demonstrates how to use the autoplay attribute with a video element − ...
Read MoreHow do we reset all the input fields in HTML forms?
In HTML forms, we often need to reset all input fields to their default values. This is accomplished using the reset button, which clears all user-entered data and restores form elements to their original state. HTML provides a built-in mechanism through the element with type="reset". When clicked, this button automatically resets all form controls within the same form to their initial values − text fields become empty, checkboxes return to their default checked state, and select dropdowns revert to their default selection. Syntax Following is the syntax for creating a reset button − ...
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 MoreChange Background color of a web page using onmouseover property
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