Harshit Sachan

Harshit Sachan

25 Articles Published

Articles by Harshit Sachan

25 articles

Python program to print even numbers in a list

Harshit Sachan
Harshit Sachan
Updated on 25-Mar-2026 13K+ Views

Python lists are fundamental data structures that store collections of items. Finding even numbers in a list is a common programming task with multiple efficient approaches. A number is even if it divides by 2 with no remainder. We will explore several methods to print even numbers from a list, each with different advantages ? Using Modulo Operator The modulo operator (%) returns the remainder when dividing two numbers. For even numbers, x % 2 == 0 will be true. Example def print_evens(numbers): for num in numbers: ...

Read More

Python program to print even length words in a string

Harshit Sachan
Harshit Sachan
Updated on 25-Mar-2026 6K+ Views

In Python, you can find and print all words in a string that have even length (divisible by 2). This is useful for text processing tasks where you need to filter words based on their character count. For example, in the string "A big cube was found inside the box", the words "cube" (length 4) and "inside" (length 6) have even lengths. Basic Approach The simplest method involves splitting the string into words and checking each word's length ? def print_even_length_words(text): # Split the string into individual words ...

Read More

How to transform background image using CSS3

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 2K+ Views

The CSS transform property allows you to apply 2D and 3D transformations to elements, including background images. You can rotate, scale, translate, and skew elements to create visual effects without affecting the document flow. Syntax selector { transform: none | transform-function | initial | inherit; } Transform Functions FunctionDescription rotate(angle)Rotates element by specified angle scale(x, y)Scales element along X and Y axes translate(x, y)Moves element along X and Y axes skew(x-angle, y-angle)Skews element along X and Y axes Example: Rotating Background Image The following example demonstrates ...

Read More

How to create an accordion hover effect with box-shadows in CSS

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 717 Views

An accordion hover effect with box-shadows in CSS creates an interactive element that expands content when hovered over, while adding visual depth through shadows. This effect combines CSS transitions, hover states, and the box-shadow property to create smooth, engaging user interactions. Syntax selector { box-shadow: x-offset y-offset blur-radius spread-radius color; } selector:hover { box-shadow: x-offset y-offset blur-radius spread-radius color; } Box-Shadow Property Values PropertyDescription x-offsetHorizontal shadow position (positive = right, negative = left) y-offsetVertical shadow position (positive = down, negative = up) blur-radiusOptional. Controls ...

Read More

How to create a Non-Rectangular Header using HTML & CSS

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 577 Views

A non-rectangular header adds visual appeal to web pages by breaking away from traditional rectangular layouts. Using CSS's clip-path property, we can create custom shapes for headers that make our designs stand out. Syntax header { clip-path: polygon(coordinates); } Basic Approach To create a non-rectangular header, we use the following steps − Create a element with content Apply the clip-path CSS property with polygon coordinates Position content appropriately within the clipped area Example 1: Wavy Bottom Header Here's how to create a header with a ...

Read More

Create the Indian Flag using HTML and CSS

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 14K+ Views

To create the Indian flag using HTML and CSS, we will need to have good understanding of CSS. Indian flag have three colors: saffron, white and green and Ashoka Chakra at the middle. In this article, we will be creating stepwise Indian flag. First making a pole then tricolor and then rotating Ashoka chakra all with the help of HTML and CSS only. Later we will be animating our flag with wave animation and flag movement. Basic Structure We will start by creating the basic HTML structure for our Indian flag − ...

Read More

10 CSS Functions every Front-end Developer should know

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 783 Views

CSS (Cascading Style Sheets) is a stylesheet language used for describing the look and formatting of a document written in HTML. CSS functions provide powerful, reusable solutions for common styling tasks, making code more maintainable and dynamic. In this article, we will explore 10 essential CSS functions that every frontend developer should know. These functions can significantly improve your styling workflow and create more flexible, responsive designs. Unlike functions in other programming languages, CSS functions focus on visual presentation rather than logic. They help calculate values, manipulate colors, select elements, and transform visual properties efficiently. The main ...

Read More

How does auto property work in margin: 0 auto in CSS?

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 3K+ Views

The margin: 0 auto property is a commonly used CSS technique that horizontally centers elements within their container. The "auto" value for the left and right margins is what enables this centering to occur. Syntax selector { margin: top-bottom left-right; } /* For centering */ selector { margin: 0 auto; } How Auto Property Works When you set margin: 0 auto, you're actually setting four margin values − Top and bottom margins: Set to 0 Left and right margins: Set to "auto" ...

Read More

How to specify no border in CSS

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 3K+ Views

The CSS border property can add visual definition to elements, but sometimes you need to remove borders entirely. This article demonstrates how to specify no border in CSS using different techniques. Syntax selector { border: none; /* or */ border: 0; /* or */ border-width: 0; } Method 1: Using border-width Property Setting border-width: 0 makes the border invisible by reducing its width to zero − ...

Read More

How to remove input background on select in CSS

Harshit Sachan
Harshit Sachan
Updated on 15-Mar-2026 6K+ Views

The default styling for HTML form elements can often be somewhat dull and uninspiring. One element that is often in need of a design overhaul is the select input, which is used to present users with a list of options to choose from. In this article, we will show you how to remove the default background of the select input using CSS. By doing so, you will be able to customize the appearance of your select inputs and make them more visually appealing and in line with the overall design of your website or application. Syntax ...

Read More
Showing 1–10 of 25 articles
« Prev 1 2 3 Next »
Advertisements