🚀 Power up Your Career with our Full-Stack JavaScript Development Course 💪

How to change font color in HTML

If you want to change the color of your HTML font, there are a couple of different ways that you can do it. One way is to use the “color” attribute in the opening tag for the element that you want to change....

November 20, 2022 · 1 min · Coderslang Master

How to center an image in HTML

Centering an image in HTML is a little harder than centering text as there’s no single CSS property that you could use to make sure your image appears at the center of the web page....

August 22, 2022 · 1 min · Coderslang Master

How to center text in HTML

Before HTML5 there used to be a <center> tag that allowed you to center text on your web page. Now it’s deprecated. If you need to center the text on your HTML page, you should use the CSS property text-align....

August 15, 2022 · 1 min · Coderslang Master

How to use BEM naming convention with SCSS

This article is for the intermediate level. This article explains the importance of writing better CSS class names with code snippets using SCSS. This article is targeted for the group of people who are interested to learn about BEM naming convention and want simple and descriptive explanation to what block, element and modifiers in BEM are....

July 16, 2022 · 6 min · Coderslang Master

Get random integer in a range using JavaScript

Similarly to generating a random float number within the specific range, you can write a function to get a random integer with a range. function getRandomIntegerInRange(min, max) { return Math.floor(Math.random() * (Math....

February 7, 2022 · 1 min · Coderslang Master

How to check if a variable is a string in JavaScript

To check that a JS variable is of a type string, you can use 2 operators: instanceof and typeof. Here’s a quick solution. if (typeof text === 'string' || text instanceof String) { // it's a string!...

January 27, 2022 · 1 min · Coderslang Master

Get random number in a range using JavaScript

To get a random number is JS you almost always rely on the function Math.random. The only issue is that it returns a number between 0 and 1. You can generate a number in a specific range by writing a straightforward function....

January 26, 2022 · 1 min · Coderslang Master

How to get screen width and height with JavaScript

The object window.screen holds all the information you about the current screen. You can access the resolution of the screen by accessing its width and height properties. ...

January 25, 2022 · 1 min · Coderslang Master

How to check if an HTML element is visible or hidden with jQuery

There are 2 jQuery selectors that can help you determine whether an HTML element is visible or not. First, you can use the selector :visible to check if an element is visible on the web page....

January 4, 2022 · 1 min · Coderslang Master

How to Print an Array in JavaScript

Learn how to print the whole array with JS and how to print individual elements of the JS array in both HTML (browser) and Node.js (server-side) environments. ...

December 31, 2021 · 1 min · Coderslang Master