Learn CSS daily

Generate Your Own Playground

Type any CSS property and get a live, editable playground instantly.

offset-path
.container { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background-color: #f0f0f0; }
.moving-box { width: 50px; height: 50px; background-color: #3498db; animation: move 5s infinite; offset-path: path('M 0 0 Q 50 100, 100 0'); offset-distance: 0%; }
@keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } }

The 'offset-path' property in CSS allows you to define a custom path for an element to follow during animations. This property is particularly useful for creating smooth and dynamic movement along predefined paths, enhancing the visual experience of web applications.

offset-distance
.container { width: 300px; height: 300px; position: relative; border: 2px solid #333; overflow: hidden; } .moving-box { width: 50px; height: 50px; background-color: red; position: absolute; offset-path: path('M 0 0 L 300 0 L 300 300 L 0 300 Z'); animation: move 4s linear infinite; offset-distance: 0%; } @keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } }

The 'offset-distance' property in CSS is used with the 'offset-path' property to control the distance of an element along a defined path. This allows for smooth animations and positioning of elements along a specified route, making it useful for creating dynamic layouts and effects.

offset-anchor
.container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
}

.box {
  width: 100px;
  height: 100px;
  background-color: #3498db;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  animation: move 2s infinite alternate;
  offset-anchor: 50% 50%;
}

@keyframes move {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(200px, 200px);
  }
}

The 'offset-anchor' CSS property defines the anchor point for an element's offset position when it is animated or transformed. This property is particularly useful for controlling the visual alignment of elements during animations or transitions, allowing for more precise placement of elements on the screen. By setting the offset-anchor, designers can create more intuitive and visually appealing animations.

offset
.container { position: relative; width: 300px; height: 300px; border: 2px solid #333; } .box { position: absolute; background-color: #4CAF50; color: white; padding: 20px; left: 50px; top: 50px; }

The 'offset' property in CSS is used to control the offset of an element within a positioned container, allowing for precise placement of elements. It is particularly useful when combined with the 'position' property to create dynamic layouts and animations. The 'offset' property can take values like 'offset-x' and 'offset-y' to specify horizontal and vertical offsets respectively.

object-position
.container { width: 300px; height: 200px; overflow: hidden; border: 2px solid #000; position: relative; } .responsive-image { width: 400px; height: 400px; object-fit: cover; object-position: top right; }

The 'object-position' property in CSS is used to specify the alignment of a replaced element, such as an image or video, within its box. This property allows you to control how the content is positioned when the dimensions of the box do not match the dimensions of the content, enabling better layout control for responsive designs.