CSS Articles

Page 84 of 130

Return the value of an attribute of the selected element using CSS

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 322 Views

The attr() CSS function returns the value of an attribute of the selected element and is commonly used with the content property in pseudo-elements to display attribute values as text content. Syntax selector::before, selector::after { content: attr(attribute-name); } Example: Displaying Link URLs The following example uses the attr() function to display the URL of a link after the link text − a::after { content: " (" attr(href) ")"; ...

Read More

Usage of var() CSS function

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 111 Views

The var() function in CSS is used to insert the value of custom properties (CSS variables) into your stylesheet. It provides a way to reuse values throughout your CSS and create more maintainable code. Syntax var(--custom-property-name, fallback-value) Possible Values ParameterDescription --custom-property-nameThe name of the custom property (must start with two dashes) fallback-valueOptional value to use if the custom property is not defined Example: Basic Usage The following example demonstrates how to define custom properties and use them with the var() function − ...

Read More

Perform Animation on CSS font-size property

Samual Sam
Samual Sam
Updated on 15-Mar-2026 1K+ Views

The CSS font-size property can be animated to create text that grows or shrinks smoothly over time. This creates engaging visual effects for headings, hover states, or attention-grabbing elements. Syntax @keyframes animation-name { keyframe-selector { font-size: value; } } selector { animation: animation-name duration timing-function iteration-count; } Example: Basic Font Size Animation The following example demonstrates animating the font-size property from its default size to 30px − ...

Read More

Usage of attr() CSS function

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 140 Views

The attr() CSS function returns the value of an attribute of the selected element. It's commonly used with the content property in ::before and ::after pseudo-elements to display attribute values dynamically. Syntax attr(attribute-name) Parameters ParameterDescription attribute-nameThe name of the HTML attribute whose value you want to retrieve Example 1: Displaying href Attribute The following example displays the URL next to each link using the attr() function − a::before { content: " (" ...

Read More

How to display columns and rows using named CSS grid items

Samual Sam
Samual Sam
Updated on 15-Mar-2026 200 Views

To display columns and rows using named CSS grid items, use the grid-area property in combination with the grid-template-areas property. This approach allows you to create intuitive, readable layouts by assigning names to grid areas. Syntax .container { display: grid; grid-template-areas: "area1 area2 area3" "area4 area5 area6"; } .item { grid-area: area-name; } Example The following example demonstrates how to create a grid layout ...

Read More

Animate bottom CSS property

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 2K+ Views

The CSS bottom property can be animated to create smooth transitions when changing an element's position from the bottom edge of its containing block. This is particularly useful for creating sliding effects and dynamic positioning animations. Syntax selector { animation: animation-name duration timing-function iteration-count; bottom: initial-value; position: absolute | relative | fixed; } @keyframes animation-name { percentage { bottom: target-value; } } Example: Animating Bottom Property ...

Read More

How to specify the size of the gap between rows in CSS Grid

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 350 Views

Use the grid-row-gap property to set the size of the gap between rows in CSS Grid. This property controls the vertical spacing between grid items, making your layouts more visually appealing and well-structured. Syntax selector { grid-row-gap: value; } Possible Values ValueDescription lengthDefines the gap size in px, em, rem, etc. %Defines the gap as a percentage of the container normalDefault value, typically 0 Example The following example demonstrates a CSS Grid layout with a 50px gap between rows − ...

Read More

Set how auto-placed items are inserted in the CSS grid

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 175 Views

The CSS grid-auto-flow property controls how auto-placed grid items are inserted in the grid container. It determines whether items flow into rows or columns and how they fill available spaces. Syntax selector { grid-auto-flow: value; } Possible Values ValueDescription rowItems are placed by filling each row (default) columnItems are placed by filling each column denseItems fill holes earlier in the grid row denseCombines row flow with dense packing column denseCombines column flow with dense packing Example: Column Flow The following example demonstrates items flowing into columns ...

Read More

CSS all Property

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 193 Views

The CSS all property is a shorthand property that resets all CSS properties to their initial, inherited, or unset values. It provides a convenient way to clear all styling from an element and start with a clean slate. Syntax selector { all: value; } Possible Values ValueDescription initialResets all properties to their initial values inheritSets all properties to inherit from parent element unsetResets properties to inherit if inheritable, otherwise to initial revertResets properties to browser default values Example: Using all: inherit The following example demonstrates how ...

Read More

Blending mode of each background layer with CSS

Samual Sam
Samual Sam
Updated on 15-Mar-2026 122 Views

The CSS background-blend-mode property sets the blending mode of each background layer. It defines how background images should blend with each other and with the background color. Syntax selector { background-blend-mode: blend-mode-value; } Possible Values ValueDescription normalDefault blending mode, no blending effect multiplyMultiplies colors, resulting in darker images screenInverts, multiplies, and inverts again, resulting in lighter images overlayCombines multiply and screen modes darkenKeeps the darkest color from each layer lightenKeeps the lightest color from each layer differenceSubtracts colors to create high contrast effects Example: Darken Blend Mode ...

Read More
Showing 831–840 of 1,299 articles
« Prev 1 82 83 84 85 86 130 Next »
Advertisements