CSS Articles

Page 26 of 130

How to Switch CSS Class between Buttons Rendered with Map()?

Nikesh Jagsish Malik
Nikesh Jagsish Malik
Updated on 15-Mar-2026 395 Views

When building web applications, developers often need to create buttons with dynamic styles. One of the most efficient ways to do this is by using the map() method in JavaScript. This method allows you to render multiple buttons with different styles based on their data. However, sometimes you might want to change the CSS class of a button dynamically based on user interaction or other events. In this article, we will discuss how to switch CSS classes between buttons rendered with map() in JavaScript. Syntax .button-class { property: value; } /* Switch ...

Read More

How to break a line without using br tag in HTML / CSS?

Asif Rahaman
Asif Rahaman
Updated on 15-Mar-2026 4K+ Views

To break a line without using br tag in HTML/CSS is useful when you want to create line breaks while preserving the semantic structure of your content. This approach gives you more control over text formatting without cluttering HTML with presentation tags. Syntax /* Method 1: Using white-space property */ selector { white-space: pre; } /* Method 2: Using HTML pre tag */ text content Method 1: Using white-space Property The CSS white-space property controls how whitespace and line breaks are handled inside an element. Using white-space: pre preserves ...

Read More

How to blend elements in CSS?

Asif Rahaman
Asif Rahaman
Updated on 15-Mar-2026 391 Views

Blending elements in CSS is a technique used to create interesting visual effects and enhance the design of a web page. With the mix-blend-mode property in CSS, you can control how an element blends with the content below it. Syntax selector { mix-blend-mode: blend-mode; } Understanding Mix-Blend-Mode mix-blend-mode is a CSS property that allows you to set the blending mode for an element. Blending modes determine how two elements blend together, with different modes producing different visual effects. By default, an element in CSS will have a blending mode ...

Read More

How to create image magnifier using?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

An image magnifier allows users to zoom in on pictures for a closer inspection, enhancing user experience and adding a professional touch to your website. Using HTML and CSS, you can create powerful image magnifiers that captivate users and improve visual engagement. Approach We will explore two different methods to create image magnifiers − Rollover/Follow zoom effect − Shows magnified content in a separate preview area Magnifying glass effect − Creates a lens-like zoom overlay on the image Method 1: Rollover/Follow Zoom Effect This technique magnifies a segment of the image in a ...

Read More

How to Create Image Lightbox Gallery using HTML CSS and JavaScript?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 4K+ Views

An image lightbox gallery is a web feature that displays images in an enlarged overlay format, allowing users to view images without navigating away from the main page. When a user clicks on a thumbnail image, it opens in a modal window with navigation controls and a close button. Syntax /* Gallery container */ .gallery { display: flex; flex-wrap: wrap; justify-content: center; } /* Lightbox overlay */ .lightbox { display: none; position: fixed; ...

Read More

How to Create Image Hovered Detail using HTML & CSS?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

Creating image hover effects with detailed text overlays adds interactivity and visual appeal to your website. By combining HTML structure with CSS styling, you can create engaging hover animations that reveal additional information when users move their cursor over images. Syntax selector:hover { property: value; } The :hover Selector The CSS :hover selector is used to select and style an element when the user hovers their mouse over it. It works in combination with other selectors to target specific HTML elements and apply styles when the cursor is positioned over ...

Read More

How to create Image Folding Effect using HTML and CSS?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

The Image Folding Effect is a popular CSS technique that creates a visually appealing paper-folding animation on images. This effect divides an image into segments that skew when hovered, simulating the appearance of folded paper. It's achieved using CSS transforms and the :nth-child selector. Transform Property The CSS transform property applies 2D or 3D transformations to elements. It can move, rotate, scale, and skew elements without affecting the document flow. Syntax transform: function(value); Common transform functions: translate() − moves an element along the x and y axis. rotate() − rotates an ...

Read More

How to select all children of an element except the last child using CSS?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 13K+ Views

To select all children of an element except the last child using CSS we will be understanding two different approaches. Each approach will be using CSS pseudo-class selectors to perform the required task. In this article, we'll see how to select all children of an element except the last child in CSS with different approaches. We will be discussing each approach in detail with examples that will help you understand how they work. Syntax /* Method 1: Using :not() pseudo-class */ parent > *:not(:last-child) { /* styles */ } /* Method ...

Read More

How to select all child elements recursively using CSS?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 13K+ Views

To select all child elements recursively using CSS, we use the universal selector (*) with a parent selector. This technique allows you to target all descendant elements, regardless of their nesting level. Syntax /* Select direct children only */ .parent > * { property: value; } /* Select all descendants recursively */ .parent * { property: value; } Example 1: Direct Child Elements Only This example selects only the direct children of the parent container using the child combinator (>) − ...

Read More

How to set indent the second line of paragraph using CSS?

Shabaz Alam
Shabaz Alam
Updated on 15-Mar-2026 3K+ Views

The CSS text-indent property is typically used to indent the first line of a paragraph. However, to create a hanging indent effect where the second and subsequent lines are indented instead of the first line, you need to combine negative text-indent with positive padding-left. Syntax selector { text-indent: negative-value; padding-left: positive-value; } How It Works To indent the second line of a paragraph, we use a two-step approach − Negative text-indent: Moves the first line to the left Positive padding-left: Moves the entire paragraph ...

Read More
Showing 251–260 of 1,299 articles
« Prev 1 24 25 26 27 28 130 Next »
Advertisements