CSS Articles

Page 38 of 130

How to apply the hover effect over the button using SASS?

Dishebh Bhayana
Dishebh Bhayana
Updated on 15-Mar-2026 8K+ Views

We can apply the hover effect over the button using SASS with the help of the :hover CSS selector. SASS stands for Syntactically Awesome Stylesheet and is a CSS pre-processor, which implies one can generate CSS from its respective SASS code. Using SASS instead of just writing CSS comes with its own set of advantages, like more readable code and easy-to-learn code syntax, and one can leverage these to style the HTML elements more easily and efficiently in a web application. In this article, we will give styling to a button element with the help of SASS. We will ...

Read More

How to apply CSS style using jQuery?

Dishebh Bhayana
Dishebh Bhayana
Updated on 15-Mar-2026 7K+ Views

We can use jQuery's .css() method to apply CSS styles to HTML elements dynamically. jQuery is a JavaScript library that simplifies DOM manipulation and allows us to add interactivity and modify CSS styles of elements programmatically. Syntax $(selector).css(property, value) OR $(selector).css({ property: value, property: value, ... }) The jQuery css() method accepts either a single property-value pair as separate arguments, or an object containing multiple CSS properties and their values. Note: To run these examples, you need to include the jQuery library in your HTML file using a CDN ...

Read More

How to apply CSS style to the different elements having the same class name in HTML?

Dishebh Bhayana
Dishebh Bhayana
Updated on 15-Mar-2026 3K+ Views

HTML classes are global attributes that are used by HTML tags to specify a list of classes that are case-sensitive in nature. These classes are then used by CSS to apply styling to that particular tag that has the class, and by JavaScript to manipulate the HTML element's behavior, interactivity, or styles. Syntax /* Select all elements with same class */ .classname { property: value; } /* Select specific element type with class */ elementname.classname { property: value; } Method 1: Using the Class Selector (.) ...

Read More

How to create a function `generateSelector` to generate CSS selector path of a DOM element ?

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 415 Views

The generateSelector function is a helpful tool for determining the CSS selector path of a specific DOM element. This is useful in scenarios like testing automation, debugging, or building tools that need to identify elements on a webpage. The function analyzes an element and its ancestors to create a unique CSS selector path. Understanding CSS Selectors CSS selectors are patterns used to select HTML elements for styling. They form the foundation of CSS by allowing you to target specific elements on a webpage. Example: Basic Element Selector The following example targets all elements and applies ...

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

How to make Google search bar like input box highlight on hover using CSS?

Riya Kumari
Riya Kumari
Updated on 15-Mar-2026 1K+ Views

Creating a Google-like search bar with hover effects enhances user experience by providing visual feedback. The key is to combine the :hover pseudo-class with the box-shadow property to create an elegant highlighting effect when users interact with the input field. Syntax input:hover { box-shadow: horizontal vertical blur spread color; } Key CSS Properties The :hover Pseudo-class The :hover pseudo-class applies styles when a user hovers over an element with their mouse ? button { ...

Read More

Designing a Working Table fan using CSS?

Riya Kumari
Riya Kumari
Updated on 15-Mar-2026 524 Views

CSS is a stylesheet language used to style HTML elements and create visually appealing websites. With CSS animations and transformations, we can create interactive elements like a working table fan that rotates continuously. In this article, we will create a working table fan using HTML and CSS. We'll use SVG elements to draw the fan blades and CSS animations to make them rotate. Syntax @keyframes animation-name { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } .element { animation: animation-name duration ...

Read More
Showing 371–380 of 1,299 articles
« Prev 1 36 37 38 39 40 130 Next »
Advertisements