Javascript Articles

Page 2 of 534

How to render thin fonts more smoothly in CSS3 with HTML?

Samual Sam
Samual Sam
Updated on 13-Mar-2026 315 Views

Rendering thin fonts smoothly is crucial for creating visually appealing web interfaces. CSS3 provides several properties that help improve font rendering, especially for thin or light weight fonts that may appear jagged or pixelated on certain displays. Font Smoothing Properties To render thin fonts more smoothly, use the following combination of CSS properties − .smooth-font { text-rendering: optimizeLegibility !important; -webkit-font-smoothing: antialiased !important; -moz-osx-font-smoothing: grayscale !important; } For Google Chrome For specific optimization in WebKit-based browsers like Google Chrome, use − ...

Read More

How to actually work with HTML5 Canvas camera/viewport?

George John
George John
Updated on 13-Mar-2026 810 Views

Working with an HTML5 Canvas camera/viewport allows you to display different portions of a larger game world or image. The camera/viewport acts like a window that shows only a specific region of your content, enabling features like scrolling backgrounds and following player characters. Using drawImage() for Viewport Implementation For viewport usage, use the drawImage() method with nine parameters to crop and display specific portions of your background image − Canvas Viewport Example ...

Read More

How to detect the dragleave event in Firefox when dragging outside the window with HTML?

Krantik Chavan
Krantik Chavan
Updated on 13-Mar-2026 205 Views

You need to track which elements dragenter and dragleave had been triggered on. Listening dragenter and dragleave on an individual element will capture not only events on that element but also events on children. The main challenge with detecting dragleave events in Firefox when dragging outside the window is that these events fire for both the target element and its children. To solve this, we create a collection that tracks all elements that have received dragenter events and removes them when dragleave occurs. Creating a Custom Drag Hover Plugin Here's a jQuery plugin that properly handles drag ...

Read More

How to reload the current page without losing any form data with HTML?

Chandu yadav
Chandu yadav
Updated on 13-Mar-2026 8K+ Views

The easiest way to reload the current page without losing form data is to use WebStorage, where you have persistent storage (localStorage) or session-based (sessionStorage) which remains in memory until your web browser is closed. Using localStorage to Preserve Form Data The key is to save form data before the page reloads and restore it after the page loads. Here's how to implement this solution − Step 1: Save Form Data Before Page Reload Use the beforeunload event to capture form data when the page is about to reload − window.onbeforeunload = function() { ...

Read More

Input type DateTime Value format with HTML

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

The datetime-local input type in HTML allows users to select both a date and time from a built-in browser picker. When the input field is clicked, a date-time picker popup appears. The value is stored in the format YYYY-MM-DDThh:mm, where T separates the date and time portions. Value Format The element uses the following ISO 8601-based format − YYYY-MM-DDThh:mm For example, 2025-03-15T14:30 represents March 15, 2025 at 2:30 PM. You can use this format to set a default value with the value attribute, or to set minimum and maximum allowed dates with min and max. Example: Basic ...

Read More

Why use IBM Worklight if it ultimately uses PhoneGap for HTML support?

Smita Kapse
Smita Kapse
Updated on 13-Mar-2026 161 Views

IBM Worklight (now known as IBM MobileFirst Platform) is a full enterprise mobile development platform, while PhoneGap (Apache Cordova) is a library focused on wrapping web applications into native mobile containers. Although both provide HTML5 and CSS support for building hybrid mobile apps, Worklight offers many additional enterprise features that PhoneGap alone cannot provide. What Is PhoneGap? PhoneGap is a software development framework originally created by Nitobi and later acquired by Adobe Systems. It allows developers to build mobile applications using web technologies like HTML, CSS, and JavaScript instead of native programming languages. PhoneGap wraps the web application in a ...

Read More

Adding HTML5 Validation to Visual Studio

Sravani S
Sravani S
Updated on 13-Mar-2026 679 Views

Visual Studio 2012 and later versions include built-in IntelliSense and validation support for HTML5. Visual Studio 2010 had basic IntelliSense support for HTML5, but VS 2012 added corresponding code snippets, making it faster and easier to write HTML5 markup. Enabling HTML5 Validation in Visual Studio Follow these steps to enable HTML5 validation − Launch Visual Studio 2012 (or later). Go to Tools > Options from the menu bar. In the Options dialog, navigate to Text Editor > HTML > Validation. In the Target dropdown, select HTML5. Click OK to apply the changes. Once enabled, Visual ...

Read More

Optimizing SVG-based sprite-sheets for CSS3 HW GPU acceleration in the mobile browser with HTML

Anvi Jain
Anvi Jain
Updated on 13-Mar-2026 124 Views

When using SVG-based sprite-sheet animations in mobile browsers, performance can suffer due to frequent repaints and the lack of hardware (GPU) acceleration. CSS3 provides several techniques to promote elements to GPU-composited layers, reducing flickering and improving animation smoothness on mobile devices. The Flickering Problem In sprite-sheet animations, frames are displayed one after another by changing the visible portion of the sprite. On mobile browsers, switching frames can cause flickering because the browser repaints the element and briefly shows a blank state between frames. This happens when the old frame is removed before the new frame finishes rendering. Fix 1: Layer ...

Read More

Use of Ionic as desktop web application with HTML5

Arjun Thakur
Arjun Thakur
Updated on 13-Mar-2026 308 Views

Ionic is an HTML5 mobile app development framework targeted at building hybrid mobile apps. Think of Ionic as the front-end UI framework that handles all the look and feel and UI interactions your app needs to be compelling − kind of like "Bootstrap for Native", but with support for a broad range of common native mobile components, slick animations, and beautiful design. Can Ionic Be Used as a Desktop Web Application? Ionic was originally built and tested for mobile only. It relies on a native wrapper like Cordova or Capacitor to run on mobile devices and access native device features. ...

Read More

addEventListener for keydown on HTML5 Canvas

Nitya Raut
Nitya Raut
Updated on 13-Mar-2026 889 Views

By default, the HTML5 element cannot receive keyboard focus, which means keydown events will not fire on it. To make the canvas focusable and responsive to keyboard events, you need to add the tabindex attribute to the canvas element. Once the canvas has focus (after being clicked or tabbed to), it can listen for keyboard events. Why tabindex Is Needed Keyboard events like keydown, keyup, and keypress only fire on elements that have focus. Since is not a form element, it is not focusable by default. Adding tabindex="0" makes it part of the normal tab order, allowing it ...

Read More
Showing 11–20 of 5,339 articles
« Prev 1 2 3 4 5 534 Next »
Advertisements