Javascript Articles

Page 2 of 534

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 123 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 307 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 888 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

Ember.js browser support with HTML

Jennifer Nicholas
Jennifer Nicholas
Updated on 13-Mar-2026 218 Views

Ember.js is an open-source, free JavaScript client-side framework used for developing web applications. It provides a complete solution for building client-side JavaScript applications, including data management and application flow. Ember.js uses the MVC (Model-View-Controller) architecture pattern. In Ember.js, the route serves as the model, Handlebars templates serve as the view, and controllers manipulate the data in the model. Browser Support for Ember.js Ember.js supports all major modern browsers. The following browsers are officially supported − Google Chrome (latest) Mozilla Firefox (latest) Microsoft Edge (latest) Safari (latest) Note: Internet Explorer 11 was supported in older versions of Ember.js (up ...

Read More

Center Triangle at Bottom of Div in HTML with CSS

Vrundesha Joshi
Vrundesha Joshi
Updated on 13-Mar-2026 976 Views

To create a triangle at the center and bottom of a , you can use the CSS ::after pseudo-element with the border trick. The triangle is formed by setting a colored top border and transparent left and right borders on a zero-width, zero-height element. It is then positioned at the bottom center of the parent div. How the CSS Triangle Trick Works When you set borders on an element with zero width and height, the borders meet at angles and form triangular shapes. By making only the top border visible (colored) and the left and right borders transparent, you get ...

Read More

The:last-child selector not working as expected in HTML5

Ankith Reddy
Ankith Reddy
Updated on 13-Mar-2026 489 Views

The :last-child CSS selector selects an element only if it is the last child of its parent, regardless of type or class. A common mistake is expecting it to select the last element of a specific type or class within a parent, but that is not how it works. This is why :last-child often does not behave as expected. When :last-child Works The :last-child selector works when the target element is literally the very last child of its parent. For example, if your selector is a:last-child, it matches only if an tag is the last child inside its parent ...

Read More

Facing Problem in retrieving HTML5 video duration

Chandu yadav
Chandu yadav
Updated on 12-Mar-2026 503 Views

A common problem when working with HTML5 video is that the duration property returns NaN (Not a Number) when you try to access it before the browser has finished loading the video's metadata. This happens because the video file's metadata (which contains the duration, dimensions, etc.) is not available immediately after the page loads. Why Does video.duration Return NaN? The HTML5 element has a readyState attribute that indicates how much data the browser has loaded. It has values from 0 to 4 − 0 (HAVE_NOTHING) − No data available yet. 1 (HAVE_METADATA) − Metadata (duration, dimensions) is loaded. ...

Read More

What is the usage of the cross-origin attribute in HTML5?

Arjun Thakur
Arjun Thakur
Updated on 12-Mar-2026 362 Views

The crossorigin attribute in HTML5 is a CORS (Cross-Origin Resource Sharing) settings attribute. It controls how the browser handles cross-origin requests when loading resources like images, scripts, and stylesheets from third-party domains.As the official specification states − The crossorigin attribute is a CORS settings attribute. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with canvas. Why Is the crossorigin Attribute Needed?By default, when you load an image from a foreign origin and draw it onto an HTML5 , the canvas becomes tainted. A tainted canvas cannot be read back using methods like ...

Read More

Remember and Repopulate File Input in HTML5

Nancy Den
Nancy Den
Updated on 12-Mar-2026 388 Views

Browsers do not allow you to programmatically set the value of a file for security reasons. This means you cannot "remember" a previously selected file and repopulate the input on page reload using JavaScript alone. However, HTML5 introduced the Drag and Drop API along with the DataTransfer object, which provides a workaround − users can drag files onto a drop zone, and your code can process those files just like a file input would. How Drag and Drop Works with Files When a user drops a file onto a designated area, the browser fires a drop event. The dropped ...

Read More

Are new HTML5 elements like <section> and <article> useless?

Chandu yadav
Chandu yadav
Updated on 12-Mar-2026 186 Views

No, HTML5 semantic elements like and are not useless. They are extremely useful for screen readers and assistive technologies, helping visually impaired users navigate and understand the structure of your web page. They are also beneficial for eBook readers, search engines, and any tool that parses HTML for meaning. While you could use generic tags for everything, semantic elements convey the purpose of the content to both browsers and developers, making your code more readable and accessible. The Element The element represents a thematic grouping of content, typically with a heading. Use it to divide ...

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