Web Developer Notes - Page 7
How to Detect Scroll Direction on a Page Using JavaScript
Last updated: 02.04.2026
Views: 373
Sometimes it is necessary to detect the direction of vertical scrolling on a website in order to dynamically change the behavior of interface elements. For example, this can be useful when working with a header or footer — hiding them while scrolling down to save screen space, and showing them again when the user scrolls up.
Scroll direction detection can also improve user experience in other s...
How to Add a Favicon to a Website
Last updated: 05.04.2026
Views: 411
A favicon (short for “favorite icon”) is a small graphical icon associated with a website. It is displayed in browser tabs, bookmarks, history lists, and sometimes in search results, helping users quickly recognize and identify a site. Favicons serve both a functional and branding purpose by improving navigation and making a website visually distinct.
In the past, the .ico format was commonly u...
How to Remove WWW From a Website Address
Last updated: 05.04.2026
Views: 1791
When setting up a website, one of the small but important technical details is choosing a preferred domain version — with or without “www”. From an SEO perspective, this decision matters because search engines may treat these versions as separate URLs if they are not properly configured. This can lead to duplicate content issues, split ranking signals, and weaker overall visibility in search resul...
How to Сlone (Copy) Object and Array in JavaScript
Last updated: 21.02.2026
Views: 311
Cloning objects and arrays is not as simple a topic as it may seem at first glance. Cloning objects and arrays in JavaScript can be done using various methods depending on the complexity (shallow vs. deep cloning).
Cloning an Array
1. Using the Spread Operator (...):
[js]
const originalArray = [1, 2, 3];
const clonedArray = [...originalArray];
console.log(clonedArray); // Output: [1, 2, 3]...
How to Center an Element Vertically Using CSS (Vertical Alignment)
Last updated: 21.02.2026
Views: 369
There are several ways of vertical alignment. In different situations, different ways are suitable. Consider some of them.
1. Using Flexbox
The easiest and most widely used method:
[css]
.container {
display: flex;
align-items: center; /* Centers vertically */
justify-content: center; /* Optional: Centers horizontally */
height: 100vh; /* Full viewport height, if needed. Or set you...