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 Shubham Vora
Page 14 of 80
How to set the vertical alignment of the content in an element with JavaScript?
In this tutorial, we will learn how to set the vertical alignment of the content in an element using JavaScript. The verticalAlign property of the HTML DOM Style object controls how content is positioned vertically within inline, inline-block, and table-cell elements. This property is particularly useful for aligning text within table cells or positioning inline elements relative to their surrounding content. Note that vertical-align only applies to inline, inline-block, and table-cell elements; it cannot be used to align block-level elements. Syntax element.style.verticalAlign = "value"; Common values include: top, middle, bottom, baseline, text-top, and ...
Read MoreHow to set the right padding of an element with JavaScript?
In this tutorial, we will learn how to set the right padding of an element with JavaScript. First, let's try to understand what padding means; padding is simply an extra space between a page's border and our content. The gap between them increases as the value of padding increases. Padding is similar to the margin; padding is distinct from the margin because padding adds space between the border and content, whereas margin is used to add space around the edge. While padding can be done on all sides, i.e., Top, Bottom, Left, and Right in the following lines, ...
Read MoreHow nested elements are rendered in 3D space with JavaScript?
This tutorial demonstrates how to control the 3D rendering of nested HTML elements using JavaScript and the CSS transform-style property. The transform-style property determines whether child elements are positioned in 3D space or flattened to their parent's plane. When working with 3D transformations like rotateY(), rotateX(), or rotateZ(), this property controls how nested elements maintain their 3D positioning relative to their parent container. Transform-Style Property Values The transform-style property accepts two main values: flat (default): Child elements are flattened to the parent's plane, losing their 3D positioning preserve-3d: Child elements maintain their 3D positioning in ...
Read MoreHow to set the four transition properties with JavaScript?
In this tutorial, we will learn how to set the four transition properties with JavaScript. The transition is a CSS property used to set the transition effect of an element. It is a shorthand property for the following: transitionProperty, transitionDuration, transitionTimingFunction, and transitionDelay. The transitionProperty is used to specify the CSS property name that should have the transition effect. The transitionDuration property is used to specify the total time to complete the transition. The transitionTimingFunction is used to specify the speed curve of the transition. The transitionDelay is used to specify after how much time the transition will ...
Read MoreHow can I convert a string to boolean in JavaScript?
This tutorial teaches us to convert a string to a boolean in JavaScript. When developing applications, you might store boolean values in databases or local storage as strings. Later, you need to convert these string values back to boolean to perform specific operations. We'll explore three effective methods to convert strings to boolean values in JavaScript. Using the Comparison (==) and Ternary operator (? :) Using the Boolean constructor Using the Double Not (!!) Operator Using the Comparison (==) and Ternary operator (? ...
Read MoreHow to set whether the text should be overridden to support multiple languages in the same document with JavaScript?
In this tutorial, we will learn how to set whether the text should be overridden to support multiple languages in the same document with JavaScript. Use the unicodeBidi property in JavaScript to set whether the text should be overridden to support multiple languages in the same document. Set it to normal, embed, or bidi-override. The bidi-override allows you to add the direction, i.e., rtl to ltr. Understanding Unicode Bidirectional Text The unicodeBidi property controls the bidirectional text algorithm for elements containing text in multiple languages, especially when mixing left-to-right (LTR) and right-to-left (RTL) scripts like Arabic or ...
Read MoreHow to handle tabs, line breaks and whitespace in a text in JavaScript?
In this tutorial, we will learn how to handle tabs, line breaks, and whitespace in text using JavaScript's CSS white-space property. JavaScript provides control over text formatting through the style.whiteSpace property. This property has several values that determine how whitespace is handled: normal - Default value; collapses multiple spaces into one, wraps text automatically pre - Preserves spaces and tabs, respects line breaks pre-wrap - Like 'pre' but also wraps long lines pre-line - Preserves line breaks but collapses spaces ...
Read MoreHow do I compare String and Boolean in JavaScript?
In JavaScript, comparing strings and booleans can produce unexpected results due to type coercion. This tutorial explains how equality operators handle these comparisons. JavaScript provides two equality operators: the equality operator (==) performs type coercion before comparison, while the strict equality operator (===) compares both value and type without coercion. Boolean Type Coercion When using the equality operator (==), JavaScript converts booleans to numbers before comparison: Boolean to Number Conversion: ...
Read MoreHow to set whether an element should be visible in JavaScript?
In this tutorial, we shall learn to set whether an element should be visible in JavaScript. Use the visibility property to hide or show an element. The visibility property takes different values such as visible, hidden, collapse, etc. To show an element, we set the visibility property to "visible" whereas to hide the element we set it to "hidden". We can also set visibility using the display property. Let us briefly discuss the two properties in JavaScript to achieve our objective. Using the Style visibility Property JavaScript provides us with the visibility property with which we can ...
Read MoreIs there a Boolean Typed Array in JavaScript?
In this tutorial, we will learn if there is a Boolean Typed Array in JavaScript. Typed Arrays are array-like objects that allow reading and writing raw binary data efficiently. They are particularly useful for handling large amounts of data like audio, video, or image processing, as they provide faster data transport compared to regular arrays. Since machines work with binary data (0s and 1s), typed arrays store information in binary format, making data transfer more efficient. Now come to the question - Is there a Boolean Typed Array in JavaScript? No, Boolean Typed Array does not exist. ...
Read More