Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 15 of 81

How do we display the thickness of the border of an element in HTML?

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 199 Views

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 More

HTML type Attribute

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 131 Views

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

Execute a script when a user is pressing a key in HTML?

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 400 Views

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

EventSource vs. wrapped WebSocket with HTML5 Server-Side Event

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 173 Views

The EventSource API and WebSocket are both HTML5 technologies for real-time communication between client and server. However, they serve different purposes and have distinct characteristics. EventSource provides server-sent events (SSE) for one-way communication from server to client, while WebSocket enables full-duplex communication in both directions. EventSource (Server-Sent Events) EventSource is a simpler, lightweight solution for receiving real-time updates from the server. It establishes a persistent HTTP connection and listens for server-pushed data in a specific text format. Key Characteristics One-way communication − Client can only receive data from the server Text/event-stream format − Uses a ...

Read More

HTML5 Canvas & z-index issue in Google Chrome

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 852 Views

When working with HTML5 Canvas elements in Google Chrome, a specific rendering issue occurs when applying z-index to a canvas with position: fixed. This bug causes Chrome to improperly render other fixed-position elements on the page, but only when the canvas dimensions exceed 256×256 pixels. The issue manifests as visual glitches or disappearing elements that also have position: fixed applied. This is a browser-specific problem that primarily affects Google Chrome and can significantly impact layout stability in web applications using large fixed canvases. The Problem The rendering issue occurs due to Chrome's internal optimization mechanisms when handling ...

Read More

Execute a script when the seeking attribute is set to false indicating that seeking has ended in HTML?

Chandu yadav
Chandu yadav
Updated on 16-Mar-2026 203 Views

The onseeked attribute in HTML executes a script when the user finishes seeking (jumping to a new position) in an audio or video element. This event fires when the seeking attribute changes from true to false, indicating that the seek operation has completed and the media is ready to play from the new position. Syntax Following is the syntax for the onseeked attribute − Where script is the JavaScript code to execute when seeking ends. How It Works When a user interacts with the video or audio controls to jump ...

Read More

How to convert a binary NodeJS Buffer to JavaScript ArrayBuffer?

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 907 Views

Converting a binary NodeJS Buffer to JavaScript ArrayBuffer is a common requirement when working with binary data across different JavaScript environments. There are multiple approaches to achieve this conversion. Method 1: Using buf.buffer Property (Direct Access) The simplest approach is to access the buf.buffer property directly. However, this creates a view of the underlying ArrayBuffer, not a copy. const buffer = Buffer.from([1, 2, 3, 4, 5]); console.log("Original Buffer:", buffer); // Direct access to underlying ArrayBuffer const arrayBuffer = buffer.buffer; console.log("ArrayBuffer byteLength:", arrayBuffer.byteLength); // Create Uint8Array view to inspect data const uint8View = new Uint8Array(arrayBuffer); ...

Read More

How to perform Automated Unit Testing with JavaScript?

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 273 Views

To perform automated unit testing in JavaScript, Unit.js is a cross-platform open-source unit testing framework that provides a simple and intuitive API for testing JavaScript applications. What is Unit.js? Unit.js is a JavaScript testing framework that works in both Node.js and browsers. It offers a fluent interface for writing readable test assertions and supports various testing patterns. Basic Syntax Unit.js uses a chainable syntax where you specify the data type and then chain assertion methods: test.dataType(value).assertionMethod(expectedValue); Simple String Testing Example Here's a basic example of testing a string value: ...

Read More

Usage of -moz-opacity property with CSS

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 848 Views

The -moz-opacity property was a Mozilla-specific CSS property used to set the opacity of HTML elements, including images. This property created transparent effects in older Firefox browsers before the standard opacity property was widely supported. Browser-Specific Opacity Properties Different browsers historically required different approaches for opacity: Mozilla Firefox: -moz-opacity Internet Explorer: filter: alpha(opacity=x) Modern browsers: opacity (standard) Syntax /* Legacy Mozilla syntax */ -moz-opacity: value; /* IE filter syntax */ filter: alpha(opacity=value); /* Modern standard syntax */ opacity: value; The value ranges from 0 (completely transparent) to 1 ...

Read More

Usage of CSS border-collapse property

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 63 Views

The border-collapse CSS property controls how adjacent table cell borders are displayed. It determines whether borders should merge together or remain separate. Syntax border-collapse: collapse | separate | initial | inherit; Values Value Description collapse Adjacent borders are merged into a single border separate Each cell maintains its own borders (default) initial Sets to default value (separate) inherit Inherits from parent element Example Here's a comparison showing both collapse and separate values: ...

Read More
Showing 141–150 of 810 articles
« Prev 1 13 14 15 16 17 81 Next »
Advertisements