Front End Scripts Articles

Page 21 of 47

Detecting HTML click-to-call support in JavaScript

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 298 Views

The tel: protocol enables click-to-call functionality on mobile devices. Most modern browsers support it, but older devices may require different protocols or detection methods. Basic tel: Protocol Support Modern mobile browsers support the tel: protocol natively: Click to Call Example Call +1 (234) 567-890 // Check if tel: links are supported function isTelSupported() { ...

Read More

HTML 5 Video Buffering a certain portion of a longer video

Krantik Chavan
Krantik Chavan
Updated on 15-Mar-2026 789 Views

The TimeRanges object in HTML5 allows you to work with buffered portions of video and audio elements. It represents a series of non-overlapping time ranges that have been buffered by the browser. TimeRanges Properties The TimeRanges object provides the following properties: length − Number of buffered time ranges start(index) − Start time of a specific range, in seconds end(index) − End time of a specific range, in seconds Accessing Buffered Ranges You can access buffered ranges using the buffered property of video or audio ...

Read More

How to handle mousedown and mouseup with HTML5 Canvas

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 916 Views

To handle the mousedown and mouseup events with HTML5 Canvas, you can attach event listeners directly to the canvas element. These events are useful for creating interactive graphics, drag-and-drop functionality, or drawing applications. Basic Syntax canvas.addEventListener('mousedown', function(event) { // Handle mouse press }); canvas.addEventListener('mouseup', function(event) { // Handle mouse release }); Example: Simple Click Detection const canvas = document.getElementById('myCanvas'); const ctx = canvas.getContext('2d'); let mouseDown = false; // Draw initial state ctx.fillStyle = '#f0f0f0'; ctx.fillRect(0, 0, 400, 300); ctx.fillStyle = ...

Read More

How can I set the color, style, and width of lines in a single property with CSS?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 171 Views

The border property allows you to specify color, style, and width of lines in one property. This shorthand property combines three individual border properties into a single declaration, making CSS more concise and easier to manage. Syntax border: width style color; Where: width - thickness of the border (e.g., 1px, 2px, thick) style - border style (solid, dashed, dotted, etc.) color - border color (name, hex, rgb, etc.) Example You can try to run the following code to specify the border property: ...

Read More

Measure text height on an HTML5 canvas element

George John
George John
Updated on 15-Mar-2026 2K+ Views

To measure text height on an HTML5 canvas element, you can extract the font size from the canvas context's font property or use the TextMetrics object for more precise measurements. Method 1: Extracting Font Size from Font Property Set the font size in points and extract the numeric value: const canvas = document.getElementById('myCanvas'); const context = canvas.getContext('2d'); // Set font in points context.font = "15pt Calibri"; // Extract height using regex to match digits var height = parseInt(context.font.match(/\d+/), 10); console.log("Text height:", height, "points"); Text height: 15 ...

Read More

Usage of border-left-style property in CSS

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

The border-left-style property defines the style of an element's left border. It accepts various values like solid, dashed, dotted, double, and more to create different visual effects. Syntax border-left-style: value; Available Values Value Description none No border (default) solid Solid line dashed Series of dashes dotted Series of dots double Two parallel lines groove 3D grooved effect ridge 3D ridged effect Example: Different Border Styles ...

Read More

Playing a WAV file on iOS Safari

Nancy Den
Nancy Den
Updated on 15-Mar-2026 574 Views

Playing WAV files on iOS Safari requires specific HTTP headers to ensure proper audio streaming and playback compatibility. Required Headers for iOS Safari iOS Safari needs these HTTP headers to properly handle WAV file playback: Content-Range: bytes 0-1023/2048 Content-Type: audio/wav Accept-Ranges: bytes Content-Length: 2048 Complete Server Implementation Here's a Node.js example showing how to serve WAV files with proper headers: const express = require('express'); const fs = require('fs'); const path = require('path'); const app = express(); app.get('/audio/:filename', (req, res) => { const filename = req.params.filename; ...

Read More

Change the color of the bottom border with CSS

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 243 Views

The border-bottom-color CSS property changes the color of an element's bottom border. This property only affects the color, not the width or style of the border. Syntax border-bottom-color: color; Parameters The property accepts standard CSS color values including hex codes, RGB values, HSL values, and named colors. Example p.demo { border: 4px solid black; ...

Read More

How can I make a div with irregular shapes with CSS3 and HTM5?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 636 Views

With CSS3, you can create various shapes including rectangles, triangles, circles, and more complex irregular shapes using properties like border-radius, transform, and clip-path. Basic Shapes Rectangle A simple rectangle is created using width and height properties: #rectangle { width: 300px; height: 150px; background: blue; } Triangle Triangles are created using border properties with transparent sides: #triangle { width: 0; height: 0; ...

Read More

Change the color of top border with CSS

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 204 Views

The border-top-color CSS property allows you to change the color of an element's top border independently of other borders. This property is useful when you want to create distinctive visual effects or highlight specific elements. Syntax border-top-color: color-value; The color value can be specified using color names, hex codes, RGB values, or HSL values. Example p.demo { border: 3px ...

Read More
Showing 201–210 of 465 articles
« Prev 1 19 20 21 22 23 47 Next »
Advertisements