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 by Chandu yadav
Page 17 of 81
How can I use the HTML5 canvas element in IE?
The HTML5 canvas element provides a powerful way to create dynamic graphics and animations directly in the browser. However, older versions of Internet Explorer (IE6-IE8) do not natively support the canvas element. To enable canvas functionality in these browsers, you can use the excanvas JavaScript library. What is ExplorerCanvas? ExplorerCanvas (also known as excanvas) is a JavaScript library that emulates HTML5 canvas functionality in Internet Explorer versions 6, 7, and 8. While modern browsers like Firefox, Safari, Chrome, and Opera support the canvas tag natively for 2D drawing operations, ExplorerCanvas brings the same functionality to older IE browsers ...
Read MoreHTML5 canvas ctx.fillText won\'t do line breaks
The fillText() method in HTML5 Canvas draws filled text but does not automatically handle line breaks. When you include newline characters () in your text string, they are ignored and the text appears as a single line. To create line breaks, you must manually split the text and call fillText() multiple times for each line. Syntax Following is the syntax for the fillText() method − context.fillText(text, x, y, maxWidth); To create line breaks, split the text and draw each line separately − var lines = text.split(''); for (var i = 0; i ...
Read MoreHow do we create preformatted text in HTML?
HTML provides the tag to create preformatted text that preserves whitespace, line breaks, and spacing exactly as written in the source code. This is essential for displaying code snippets, ASCII art, or any content where formatting matters. Note − The tag mentioned in older tutorials is deprecated and should not be used. The modern approach uses the tag combined with proper HTML entity encoding. Syntax Following is the syntax for creating preformatted text − Preformatted text content with preserved spacing and line breaks ...
Read MoreHTML target Attribute
The target attribute of the element specifies where to display the response received after submitting the form. It controls whether the form response opens in the same window, a new tab, a specific frame, or the parent window. Syntax Following is the syntax for the target attribute − Target Attribute Values The target attribute accepts the following predefined values − _blank − Opens the form response in a new window or tab. _self − Opens the form response in the same frame (default behavior). _parent − Opens the form ...
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 MoreHTML type Attribute
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 MoreExecute a script when a user is pressing a key in HTML?
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 MoreEventSource vs. wrapped WebSocket with HTML5 Server-Side Event
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 MoreHTML5 Canvas & z-index issue in Google Chrome
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 MoreExecute a script when the seeking attribute is set to false indicating that seeking has ended in HTML?
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