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
HTML Articles
Page 127 of 151
How to get the value of the usemap attribute of an image with JavaScript?
To get the value of the usemap attribute of an image, use the useMap property. This property returns the value of the usemap attribute, which specifies which image map to use with the image. Syntax let value = imageElement.useMap; Example ...
Read MoreWhat is the usage of onscroll event in JavaScript?
The onscroll event in JavaScript occurs when an element's scrollbar is being scrolled. This event is commonly used to create interactive features like scroll-triggered animations, infinite scrolling, or scroll position indicators. Syntax element.onscroll = function() { // Code to execute when scrolling }; // Or using addEventListener element.addEventListener('scroll', function() { // Code to execute when scrolling }); Basic Example Here's a simple example showing how to detect when a div element is scrolled: ...
Read MoreHow do we include the direction of text display in HTML?
Use the dir attribute in HTML to specify the text direction. This attribute controls whether text flows left-to-right (LTR) or right-to-left (RTL). Syntax content Attribute Values Value Description Use Case ltr Left-to-right English, French, German rtl Right-to-left Arabic, Hebrew, Urdu auto Browser determines direction Mixed language content Example Here's how to use the dir attribute for different text directions: Text Direction Example This is default left-to-right text. ...
Read MoreWhat is the usage of onblur event in JavaScript?
The onblur event in JavaScript triggers when an HTML element loses focus. This commonly occurs when users click away from an input field, tab to another element, or programmatically change focus. Syntax // OR element.onblur = function() { /* code */ }; // OR element.addEventListener('blur', function() { /* code */ }); Example: Input Field Validation Enter your email and click outside the field: ...
Read MoreFlexbox and vertical scroll in a full-height app using newer Flexbox API with HTML
The flex property is a shorthand for the flex-grow, flex-shrink, and flex-basis properties. The flex property sets the flexible length on flexible items. When creating full-height applications with scrollable content areas, proper flexbox configuration is essential. Basic Flexbox Scroll Setup To create a scrollable flex item that takes up remaining space, use flex: 1 1 auto with overflow-y: auto: #container { display: flex; flex-direction: column; height: 100vh; } #container article { flex: 1 1 auto; ...
Read MoreWhat is the usage of onfocus event in JavaScript?
The onfocus event is triggered when an HTML element receives focus, typically when a user clicks on an input field or navigates to it using the Tab key. This event is commonly used to provide visual feedback or perform actions when users interact with form elements. Syntax // HTML attribute // JavaScript event listener element.onfocus = function() { /* code */ }; element.addEventListener('focus', function() { /* code */ }); Example: Basic onfocus Implementation Click on the input field to see the onfocus effect: ...
Read MoreWhat is the usage of oninput event in JavaScript?
The oninput event occurs whenever the value of an input element changes. Unlike onchange, which fires only when the element loses focus, oninput triggers immediately as the user types, making it ideal for real-time validation and live search functionality. Syntax // HTML attribute // JavaScript property element.oninput = function() { /* code */ }; // Event listener element.addEventListener('input', function() { /* code */ }); Basic Example oninput Example Type something below: ...
Read MoreHTML5 Canvas distorted
HTML5 Canvas distortion occurs when the canvas element's CSS dimensions don't match its internal drawing dimensions. This creates scaling issues that make drawings appear stretched or blurry. Understanding Canvas Dimensions Canvas has two sets of dimensions: Drawing dimensions: Set via width and height attributes Display dimensions: Set via CSS width and height properties When these don't match, the browser scales the drawing surface to fit the display size, causing distortion. Default Canvas Size The default canvas dimensions are: width = 300px height = 150px This gives a 2:1 aspect ...
Read MoreWhat is the usage of oninvalid event in JavaScript?
The oninvalid event is triggered when a form field fails HTML5 validation constraints. It fires before form submission when an field with validation attributes (like required, pattern, etc.) contains invalid data. Syntax element.oninvalid = function() { // Handle invalid input }; // Or in HTML Basic Example Here's how to use oninvalid to show custom validation messages: Enter Name: ...
Read MoreAdd sizes for Bootstrap Buttons
Bootstrap provides several CSS classes to control button sizes, from large buttons to block-level buttons that span the full width of their container. Button Size Classes Class Description .btn-lg ...
Read More