CSS offset 属性值说明

描述
offset-position指定偏移路径的初始位置。
offset-path指定要遵循的元素的移动路径。
offset-distance指定偏移路径的位置。
offset-anchor沿偏移路径定义盒子的锚点。
offset-rotate指定元素的方向。
initial使属性使用其默认值。
inherit从父母元素继承属性。

语法

offset: offset-position/offset-path/offset-distance/offset-anchor/offset-rotate | initial | inherit;

偏移属性示例:

<!DOCTYPE html>
<html>
  <head>
    <title>文档的标题</title>
    <style>
      @keyframes move {
        from {
          offset-distance: 0%;
        }
        to {
          offset-distance: 100%;
        }
      }
      div {
        width: 60px;
        height: 60px;
        background-color: #8ebf42;
        offset: path("M 100 100 L 300 100 L 200 300 z") auto;
        animation: move 4s linear infinite;
      }
    </style>
  </head>
  <body>
    <h2>Offset 属性示例</h2>
    <div></div>
  </body>
</html>
CSS 偏移属性

offset 属性沿指定路径为元素设置动画。

它是以下属性的简写属性:

  • offset-position
  • offset-path
  • offset-anchor
  • offset-rotate
  • offset-distance

在早期的规范中,偏移属性被称为“运动”。

该特性是一项实验技术。

初始值自动无0自动自动
应用于可变形元素。
继承无效
可动画的是的。
版本运动路径模块级别1
DOM 语法object.Style.Offset =“auto”;
日期:2020-06-02 22:14:41 来源:oir作者:oir