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 Prabhas
Page 2 of 6
Convert text to uppercase with CSS
To convert text to uppercase with CSS, use the text-transform property with the value uppercase. This property transforms the visual appearance of text without modifying the actual content. Syntax text-transform: uppercase; Example Here's how to convert text to uppercase using CSS: .uppercase-text { text-transform: uppercase; } ...
Read MoreWhat is the best way to initialize a JavaScript number?
The best way to initialize a number in JavaScript is to assign a value during variable declaration. This approach prevents undefined values and ensures your variables are ready to use immediately. Basic Number Initialization You can initialize numbers using various declaration keywords: Number Initialization // Initialize with var var deptNum = 20; var employeeId = 5; // Note: ...
Read MoreHow to create JavaScript alert with 3 buttons (Yes, No and Cancel)?
The standard JavaScript alert box won't work if you want to customize it. For that, we have a custom alert box, which we're creating using jQuery and styled with CSS. Understanding the Problem JavaScript's built-in alert() and confirm() functions are limited - they only provide basic "OK" or "OK/Cancel" options. To create a custom dialog with Yes, No, and Cancel buttons, we need to build our own solution using HTML, CSS, and JavaScript. Complete Example Here's a complete implementation of a custom alert with three buttons: ...
Read MoreGenerating sound on the fly with JavaScript/ HTML5
The Web Audio API is used to control audio, which allows you to choose audio sources. You can also add effects, create audio visualizations, panning, and generate sounds programmatically in web browsers. Basic Sound Generation To generate sound with the Web Audio API, you need three main components: an AudioContext, an oscillator (sound source), and a destination (speakers). Here's how to create a simple tone: Generate Sound Play 500Hz Tone ...
Read MoreWorking with Inline CSS
Inline CSS allows you to apply styles directly to HTML elements using the style attribute. This method applies styles to individual elements only, making it useful for quick styling or element-specific customizations. Syntax You can use the style attribute on any HTML element to define inline style rules: Style Attribute Attribute Value ...
Read MoreHow can I trigger a JavaScript click event?
In JavaScript, you can programmatically trigger a click event on an element using the click() method. This is useful for automating user interactions or creating custom behaviors. Using the click() Method The click()
Read MoreWhat are generator functions in JavaScript?
Generator functions in JavaScript allow you to pause and resume function execution, providing powerful control over program flow. Unlike regular functions that run to completion, generators can yield values multiple times and maintain their internal state between calls. Syntax Generator functions are defined using the function* syntax with an asterisk. The asterisk can be placed in different positions: function* myGenerator() {} // or function *myGenerator() {} // or function*myGenerator() {} How Generator Functions Work Generator functions use the yield keyword to pause execution and return a value. When called, they return a generator ...
Read MoreWith CSS set the element to retain the style values that are set by the last keyframe
The CSS animation-fill-mode property with the forwards value is used to retain the style values that are set by the last keyframe when the animation completes. This prevents the element from reverting to its original state after the animation ends. Syntax selector { animation-fill-mode: forwards; } Example The following example demonstrates how an element retains the final animation state using animation-fill-mode: forwards − .animated-box { ...
Read MoreAdd space inside a form's text field with CSS
To add space inside a form's text field, use the CSS padding property. This creates internal spacing between the text and the field's border, making the input more visually appealing and easier to read. Syntax input[type="text"] { padding: value; } Example: Adding Space Inside Text Fields The following example demonstrates how to add internal spacing to text input fields − input[type="text"] { width: 100%; ...
Read MoreCSS3 Multi color Gradients
CSS3 multi-color gradients allow you to create smooth transitions between multiple colors in a single gradient. Unlike simple gradients that use only two colors, multi-color gradients can include three or more colors to create vibrant, complex color effects. Syntax selector { background: linear-gradient(direction, color1, color2, color3, ...); } Example The following example demonstrates a multi-color linear gradient with seven colors − #grad { height: 100px; ...
Read More