CSS Articles

Page 28 of 130

Which property specifies the right padding of an element in CSS?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 326 Views

In CSS, the padding property allows us to add extra space between the HTML element's border and its content. The right padding means only adding the space between the element's content and the right border. Here, we will learn two different properties to specify the right padding of an element. Syntax selector { padding-right: value; } Use the padding-right CSS Property The padding-right property specifies the right padding of an element in CSS. Whenever we specify the right padding for an element, the width of the element becomes equal ...

Read More

Which property is used to make a font oblique?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 481 Views

In CSS, we can use the font-style property to set the style of the font. We can use different styles as values of the font-style property, and oblique is one of them. The oblique font is a slanted version of the text that creates a sloped appearance. Unlike italic fonts which use specifically designed slanted characters, oblique fonts are created by mathematically slanting the normal font characters. Syntax selector { font-style: oblique; } Example 1: Basic Oblique Font In the example below, we have created two paragraphs to compare ...

Read More

Which one should we use ‘border: none’ or ‘border: 0 ‘?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 1K+ Views

In CSS, when you need to remove borders from HTML elements, you have two main options: border: none and border: 0. While both visually remove the border, they work differently under the hood and have different performance implications. Syntax /* Remove border using none */ border: none; /* Remove border using 0 */ border: 0; Border: none VS border: 0 Understanding the difference between these two approaches is crucial for writing efficient CSS − border: none border: 0 Sets border-style: none Sets border-width: 0 Hides the ...

Read More

What is maximum & minimum value for z-index property in CSS?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 3K+ Views

In CSS, the z-index property controls the stacking order of overlapping elements. Elements with higher z-index values appear in front of elements with lower values, creating a layered effect. The z-index property has specific limits: the maximum value is 2147483647 and the minimum value is -2147483647. These numbers represent the maximum and minimum values of a 32-bit signed integer. Note − The z-index property only works with positioned elements (relative, absolute, fixed, or sticky). It has no effect on elements with static positioning. Syntax selector { z-index: value; } ...

Read More

Set the opacity only to background color not on the text in CSS

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 8K+ Views

To set the opacity only to background color not on the text in CSS, you can use RGBA or HSLA color values with an alpha channel. This technique is particularly useful for creating overlays, cards, or popups where you want the background to be semi-transparent while keeping the text fully opaque. Syntax /* Using RGBA */ selector { background-color: rgba(red, green, blue, alpha); } /* Using HSLA */ selector { background-color: hsla(hue, saturation, lightness, alpha); } Method 1: Using RGBA Values The RGBA color model ...

Read More

Set the limit of text length to N lines using CSS

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 13K+ Views

To set the limit of text length to N lines, it can help in more organized presentation of text and better readability. This process is also known as truncating. In this article we will be understanding different approaches to truncate the text. In this article, we are having a div element with some text content in it. Our task is to limit the text length to N lines using CSS. Syntax /* For single line truncation */ selector { overflow: hidden; white-space: nowrap; text-overflow: ...

Read More

Make a div horizontally scrollable using CSS

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 6K+ Views

To make a div horizontally scrollable we will need to use the CSS overflow property. In this article we will show all the possible ways to make div horizontally scrollable. First, let's understand why we need to make a div horizontally scrollable. For example, the width of the parent div element is 500px, or the screen size is 500px. Now, the content of the div element is 1500px. So, if we don't make the parent div horizontally scrollable, it breaks the UI of the application. So, we can make it scrollable, and users can scroll to see the invisible ...

Read More

How to create Nested Accordion using Google AMP amp-accordion?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 552 Views

Nested accordion menus are an effective way to organize and present large amounts of information in a compact and intuitive manner. With Google Accelerated Mobile Pages (AMP), you can create fast-loading, interactive nested accordions using the amp-accordion component. Syntax Header Accordion Attributes AttributeDescription expand-single-sectionOnly one section can be expanded at a time animateAdds animation when expanding/collapsing disable-session-statesDisables state persistence between page loads Required Scripts Include these scripts in your HTML head section: ...

Read More

How to create multiple background image parallax in CSS?

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

Parallax scrolling is a visual effect that creates depth by moving background elements at different speeds than foreground content. Using multiple background images with CSS animations, you can create engaging parallax effects that add movement and dimension to your web pages. Syntax .container { background-image: url(image1.jpg), url(image2.jpg); animation: parallax-move duration linear infinite; } @keyframes parallax-move { 0% { transform: translateX(0); } 100% { transform: translateX(-100px); } } Key Properties background-image Property The background-image property allows you ...

Read More

How to set a rotated element’s base placement in CSS ?

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

The CSS transform-origin property allows you to control the base placement (anchor point) of rotated elements. By default, elements rotate around their center, but you can change this to any point to achieve different visual effects. Syntax selector { transform: rotate(angle); transform-origin: x-position y-position; } Transform-Origin Values ValueDescription centerDefault - rotates around the center point top leftRotates around the top-left corner bottom rightRotates around the bottom-right corner 50% 0%Uses percentages for precise positioning 20px 10pxUses pixel values for exact positioning Example 1: Default ...

Read More
Showing 271–280 of 1,299 articles
« Prev 1 26 27 28 29 30 130 Next »
Advertisements