To style elements with a value within a specified range, use the CSS :in-range pseudo-class selector. This selector applies styles only when the input's value falls within the defined min and max attributes. Syntax input:in-range { property: value; } Example: Basic In-Range Styling The following example demonstrates styling a number input when its value is within the specified range − input:in-range { border: 3px dashed orange; ... Read More
The _Generic keyword in C is used to define type-generic macros that can work with different data types. This keyword was introduced in the C11 standard to enable compile-time type selection, allowing a single macro to behave differently based on the type of its argument. Syntax #define macro_name(x) _Generic((x), \ type1: expression1, \ type2: expression2, \ default: default_expression \ )(x) The _Generic expression evaluates to one of the specified expressions based on the type of the controlling expression (x). Parameters ... Read More
To disable text wrapping inside an element, use the CSS white-space property with the nowrap value. This forces all text content to remain on a single line, preventing it from wrapping to the next line even if it overflows the container. Syntax selector { white-space: nowrap; } Example: Preventing Text Wrapping The following example demonstrates how to disable text wrapping using the white-space: nowrap property − .normal-text { width: 200px; ... Read More
A Product Array Puzzle is a common programming problem where we need to construct an array such that each element contains the product of all elements in the original array except the element at that position. The constraint is that we cannot use the division operator. Syntax void productArray(int arr[], int n, int result[]); // arr[] - input array // n - size of array // result[] - output array containing products Approach: Using Left and Right Product Arrays The solution uses two auxiliary arrays to store products of elements to the ... Read More
The CSS :hover selector is a pseudo-class that applies styles to an element when a user hovers over it with their mouse cursor. It's commonly used to create interactive effects on links, buttons, and other elements to enhance user experience. Syntax selector:hover { property: value; } Example 1: Basic Link Hover Effect The following example demonstrates how to change the background color of a link when hovering over it − a:hover { ... Read More
The CSS :focus pseudo-class selector is used to target and style an element when it receives focus through user interaction, such as clicking on an input field or navigating to it using the Tab key. Syntax selector:focus { property: value; } Example: Styling Input Fields on Focus The following example changes the background color of input fields when they receive focus − input:focus { background-color: lightblue; ... Read More
In C, when you assign one structure variable to another, a shallow copy is typically performed. However, there is an important exception: if a structure member is an array, the compiler automatically performs a deep copy of that array. This means the array contents are copied element by element, creating independent copies in memory. Syntax struct_type destination = source; // Assignment copies all members Example: Deep Copy of Array Members The following example demonstrates how array members within structures are deep copied automatically − #include #include typedef struct ... Read More
An Armstrong number (also known as narcissistic number) is a number that is equal to the sum of its own digits raised to the power of the number of digits. For example, 153 is an Armstrong number because 1³ + 5³ + 3³ = 1 + 125 + 27 = 153. Syntax int armstrong(int number); Formula For an n-digit number with digits d₁, d₂, ..., dₙ − Armstrong Number = d₁ⁿ + d₂ⁿ + ... + dₙⁿ Example: 153 (3-digit number) 1³ + 5³ + ... Read More
The CSS column-span property is used to specify how many columns an element should span across in a multi-column layout. This property allows specific elements to break out of the column flow and span across multiple or all columns. Syntax selector { column-span: value; } Possible Values ValueDescription noneThe element does not span multiple columns (default) allThe element spans across all columns Example: Element Spanning All Columns The following example demonstrates how a heading element spans across all columns in a multi-column layout − ... Read More
The CSS3 column-rule-color property is used to specify the color of the vertical line (rule) that appears between columns in a multi-column layout. This property works in conjunction with column-rule-style and column-rule-width to create visible separators between columns. Syntax selector { column-rule-color: color-value; } Possible Values ValueDescription color-nameStandard color names like red, blue, green hex-valueHexadecimal color codes like #ff0000, #00ff00 rgb()RGB color values like rgb(255, 0, 0) rgba()RGB with alpha transparency like rgba(255, 0, 0, 0.5) initialSets the property to its default value inheritInherits the value from parent element ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Economics & Finance