Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
CSS Articles
Page 100 of 130
What are CSS Transitions?
CSS transitions allow you to smoothly animate changes to CSS properties over a specified duration. Instead of property changes happening instantly, transitions create a gradual change effect that enhances user experience. Syntax selector { transition: property duration timing-function delay; } Transition Properties PropertyDescriptionExample Value transition-propertySpecifies which CSS property to animatewidth, height, all transition-durationSets how long the transition takes2s, 500ms transition-timing-functionControls the speed curveease, linear transition-delayDelays the start of transition1s, 200ms Example: Height Transition The following example demonstrates a smooth height transition when hovering over an element ...
Read MoreCSS backface-visibility Property
The CSS backface-visibility property determines whether an element should be visible when it is rotated away from the user and its back face is showing. This property is particularly useful in 3D transformations and animations. Syntax selector { backface-visibility: visible | hidden; } Possible Values ValueDescription visibleThe back face is visible when turned towards the user (default) hiddenThe back face is hidden when turned towards the user Example 1: Visible Backface The following example shows an element with backface-visibility set to visible − ...
Read MoreHow to select elements with a specified attribute and value with CSS
The CSS [attribute="value"] selector is used to select elements that have a specific attribute with an exact matching value. This attribute selector is particularly useful for targeting elements based on their HTML attributes like rel, type, class, or custom data attributes. Syntax element[attribute="value"] { /* CSS properties */ } Example: Selecting Links with Specific rel Attribute The following example demonstrates how to select and style anchor elements that have a rel attribute with the value "nofollow" − ...
Read MoreHow to select elements with a specified attribute with CSS
CSS attribute selectors allow you to target HTML elements that contain a specific attribute, regardless of the attribute's value. The [attribute] selector is used to select all elements that have the specified attribute present. Syntax [attribute] { /* styles */ } Example: Selecting Images with Alt Attribute The following example applies an orange border to all elements that have an alt attribute − img[alt] { border: 3px solid orange; ...
Read MoreCSS perspective-origin property
The CSS perspective-origin property defines the position from which the viewer is looking at 3D-positioned elements. It determines the vanishing point for the perspective effect, controlling how 3D transformations appear to the viewer. Syntax selector { perspective-origin: x-position y-position; } Possible Values ValueDescription x-positionHorizontal position: left, center, right, or percentage/length values y-positionVertical position: top, center, bottom, or percentage/length values initialSets to default value (50% 50%) inheritInherits from parent element Example: Left Origin Perspective The following example demonstrates how perspective-origin: left affects the viewing angle of a ...
Read MoreUsage of CSS perspective property
The CSS perspective property defines the distance between the user and the z-axis of an element, creating a 3D perspective effect. It controls how 3D transformed elements appear by setting the viewing distance for the transformation. Syntax selector { perspective: value; } Possible Values ValueDescription lengthDistance in px, em, rem, etc. Lower values create more dramatic perspective noneNo perspective applied (default) Example: Comparing Different Perspective Values The following example demonstrates how different perspective values affect 3D rotated elements − ...
Read MoreSpecify how nested elements are rendered in 3D space
The CSS transform-style property controls how nested child elements are rendered in 3D space. It determines whether child elements are positioned in the flat plane of their parent element or in 3D space. Syntax selector { transform-style: flat | preserve-3d; } Possible Values ValueDescription flatChild elements are flattened into the parent's plane (default) preserve-3dChild elements maintain their 3D positioning relative to the parent Example: Nested 3D Elements The following example shows how preserve-3d allows nested child elements to maintain their 3D transformations − ...
Read MoreChange the position on transformed elements with CSS
The CSS transform-origin property is used to change the position (origin point) from which transformations are applied to elements. By default, transformations like rotation, scaling, and skewing occur from the center of the element, but transform-origin allows you to specify a different reference point. Syntax selector { transform-origin: x-axis y-axis z-axis; } Possible Values ValueDescription x-axisDefines the position on the x-axis (left, center, right, %, px) y-axisDefines the position on the y-axis (top, center, bottom, %, px) z-axisDefines the position on the z-axis for 3D transformations (px) ...
Read MoreCSS content-box Value
The CSS background-origin property with the content-box value positions the background image to start from the upper left corner of the content area, excluding padding and borders. This gives you precise control over where your background image begins. Syntax selector { background-origin: content-box; } Possible Values ValueDescription padding-boxBackground starts from the padding edge (default) border-boxBackground starts from the border edge content-boxBackground starts from the content edge Example: Comparing Background Origin Values The following example demonstrates the difference between padding-box, border-box, and content-box values − ...
Read MoreUsage of transform-origin property with CSS
The CSS transform-origin property sets the point around which an element's transformation takes place. By default, transformations occur around the center of an element, but you can change this origin point to any position. Syntax selector { transform-origin: x-axis y-axis z-axis; } Possible Values ValueDescription x-axisHorizontal position: left, center, right, or percentage/length y-axisVertical position: top, center, bottom, or percentage/length z-axisZ-axis position for 3D transformations (length value) Example: Transform Origin with Rotation The following example demonstrates how transform-origin affects the rotation point of an element − ...
Read More