Found 8591 Articles for Front End Technology

JavaScript Array.from() Method

AmitDiwan
Updated on 08-May-2020 10:59:07

150 Views

The Array.from() creates a new array object from a given array instance.Following is the code for the array from() function −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript Array from() example CLICK HERE Click on the above button to create the array from given string    let fillEle = document.querySelector(".sample");    let arr = "HelloWorld";    fillEle.innerHTML = arr;    document.querySelector(".Btn").addEventListener("click", () => {       fillEle.innerHTML = Array.from(arr);    }); OutputOn clicking the “CLICK HERE” button the string will convert into array as follows −

JavaScript clearTimeout() & clearInterval() Method

Shriansh Kumar
Updated on 30-Jul-2024 16:32:42

2K+ Views

In JavaScript, the clearTimeout() and clearInterval() methods are used to clear timers. When we set a timer using setTimeout() or setInterval() methods, the browser allocates memory to track it. Therefore, we use these methods to release that memory and avoid unnecessary function calls. It is best practice to clear timers when they are no longer needed. In this article, we will learn how the clearTimeout() and clearInterval() methods help to clear timers. JavaScript clearTimeout() method The clearTimeout() method in JavaScript clears the timeout that has been previously set by the setTimeout() function. It accepts a single integer value as a ... Read More

JavaScript Callbacks

Alshifa Hasnain
Updated on 26-Feb-2025 19:37:22

750 Views

In JavaScript, since functions are objects we can pass them as parameters to another function. These functions can then be called inside another function and the passed function is referred to as a callback function. Why Use Callbacks? The following are the advantages of using JavaScript Callbacks − Encapsulation: Separates logic for better modularity. Reusability: Allows different callback functions for different processing needs. Asynchronous Execution: Commonly used in event handling, API requests, and file operations. Using a Callback Function Below is an example where an add() ... Read More

How to clear floats with the "clearfix" hack with CSS?

AmitDiwan
Updated on 16-Nov-2023 16:17:10

115 Views

The floats in CSS defines how an element should float. Let’s say, an element is taller than the element containing it. If it is floated, it will overflow outside of its container. Therefore, it’s hack is to use the overflow property and set the value auto. Without Clearfix Let us understand the issue by running the following program. Clearly, overflow occurs and the image moves outside − Example body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } ... Read More

How to create equal height columns with CSS?

AmitDiwan
Updated on 14-Dec-2023 17:08:01

1K+ Views

Equal height columns can be created in a parent div on a web page. First, set the parent container as a table with the width 100%. Within that, create the columns and set the display property to table-cell. Let us see how to create equal height columns with HTML and CSS. Create a parent container Column 1 Column 1 Column 1 Column ... Read More

How to create a sticky element with CSS?

AmitDiwan
Updated on 14-Dec-2023 12:13:46

455 Views

On a web page, we can easily create an element and position it sticky i.e., that specific element will remain stick even when the web page is scrolled. This is achieved using the position property with the value sticky. Create a div for the sticky element Set a parent div container − Sticky Element Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit vel dolore delectus esse consequatur at nulla, consequuntur sint quas ea. Incidunt, ex. Consequatur ipsa earum veritatis fugiat iusto, doloremque sunt beatae quaerat laboriosam nemo soluta ... Read More

How to Create a Fixed Footer with CSS?

AmitDiwan
Updated on 12-Feb-2025 09:44:05

771 Views

To create a fixed footer with CSS, we will use CSS position property. A fixed footer means that the footer will remain fixed at the bottom irrespective of the page scrolling. We will be discussing two different approaches to achieve this. In this article, we are having some written content in a box and a footer. Our task is to create a fixed footer with CSS. Approaches to Create a Fixed Footer Here is a list of approaches to create a fixed footer with CSS which we will be discussing in this article with stepwise explanation and complete example codes. ... Read More

How to create a glowing text with CSS?

AmitDiwan
Updated on 15-Nov-2023 17:56:17

319 Views

To create a glowing text with CSS, use the animation property. For animations, we use @keyframes. The @keyframes is a rule wherein you need to specify the CSS styles. Bind the animation to an element for it to work successfully. The animation-name property is used to set the name of the @keyframes animation. The duration of the animation is set using the animation-duration property. In the same way, we have the following properties that allows animations on a web page − animation animation-name animation-duration animation-delay animation-iteration-count animation-direction animation-timing-function animation-fill-mode However, in this example, we have used the shorthand animation property to create a glowing text. We have set the following ... Read More

How to create a responsive cutout/knockout text with CSS?

AmitDiwan
Updated on 08-Dec-2023 16:41:16

262 Views

A responsive knockout text transforms when the web browser size is changed. A knockout text looks like it's been cut out of a surface to reveal the background. First, we will place a background image on the web page using the background-image property. The text will be placed using the position property. To transform, the translate() will be used. Set the background image To create a knockout text, first set the background image on which the text will appear. The background image will be included using the background-image property with the url() − background-image: url("https://images.pexels.com/photos/957024/forest-trees-perspective-bright-957024.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"); The container for ... Read More

How to create an unordered list without bullets using CSS?

AmitDiwan
Updated on 14-Dec-2023 15:40:30

594 Views

An ordered or unordered list is always visible with number or bullets respectively. These are the styles of a list on a web page set using the list-style-type property. Let us see how to create an unordered list without bullets. Create an unordered list An unordered list is created using the element − Tiger Giraffe Lion Panther Jaguar Style the list and remove the bullets Set the list-style-type property to none to remove the bullets from the unordered list − ul { ... Read More

Advertisements