CSS Articles

Page 40 of 130

How to prevent text from occupying more than one line in CSS?

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

In web development, controlling text layout is essential for creating readable and visually appealing content. Sometimes you need to prevent text from wrapping to multiple lines, especially in navigation menus, buttons, or table cells where single-line text is preferred. Syntax selector { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } Understanding Text Overflow Text overflow occurs when content exceeds its container's dimensions. By default, text wraps to new lines, but you can control this behavior using CSS properties. Basic Overflow Example ...

Read More

Explain Nesting and Grouping in CSS

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

Nesting and Grouping in CSS are powerful techniques that help developers write clean, maintainable, and efficient code. Nesting allows you to target child elements within parent elements, while grouping applies the same styles to multiple selectors at once. Syntax /* Nesting Syntax */ parent-selector child-selector { property: value; } /* Grouping Syntax */ selector1, selector2, selector3 { property: value; } Nesting in CSS The nesting property in CSS enables developers to nest one specific style rule within another, with the child rule's selector relative to the parent ...

Read More

Difference between auto, 0 and no z-index

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

The CSS z-index property controls the stacking order of positioned elements on the z-axis (depth). Understanding the differences between auto, 0, and no z-index is crucial for proper element layering. Syntax selector { z-index: auto | integer | initial | inherit; } Z-Index Values ValueDescriptionBehavior autoDefault valueSame stacking level as parent, no new stacking context 0Integer valueCreates new stacking context at level 0 No z-indexProperty not specifiedBehaves like auto Positive integerNumbers like 1, 2, 3Higher values stack above lower values Negative integerNumbers like -1, -2, -3Stacks below elements with ...

Read More

How can I stock two arrow images (upvote/ downvote) on top of each other using CSS?

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

The CSS display, float, and clear properties allow you to stack arrow images (upvote/downvote) on top of each other vertically. This is commonly used in voting systems or navigation interfaces where arrows need to be positioned one above the other. Syntax .container { display: block; float: left; clear: left; } .container img { display: block; float: none; clear: both; } Example: Basic Arrow Images First, let's see how to ...

Read More

How to create Text Split effect using CSS?

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

The CSS text split effect creates visually engaging typography by dividing text into parts that animate when users hover over them. This effect enhances user interaction and adds dynamic visual appeal to web pages through creative text animations. Syntax /* Using pseudo-elements for horizontal split */ element::before, element::after { content: attr(data-text); position: absolute; clip-path: polygon(coordinates); transition: transform duration; } /* Using clip-path for vertical split */ element { clip-path: polygon(x y, x y, x y); ...

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

How to align text in CSS where both columns are straight?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 5K+ Views

CSS provides several methods to align text in two straight columns. This technique is useful for creating layouts where content needs to be evenly distributed across two vertical sections while maintaining proper alignment. Syntax /* Using Flexbox */ .container { display: flex; justify-content: space-between; } /* Using Float */ .column { float: left; width: 50%; } /* Using Text Align */ .column { text-align: left | center | right; } Method 1: Using ...

Read More
Showing 391–400 of 1,299 articles
« Prev 1 38 39 40 41 42 130 Next »
Advertisements