Sifat offset CSS
- Hal sebelumnya object-position
- Hal berikutnya offset-anchor
Definisi dan penggunaan
offset
Atribut digunakan untuk menganimasikan elemen sepanjang jalur, adalah bentuk singkat dari atribut berikut:
Bergantung kepada pengaturan offset
Bentuk berbeda nilai atribut, lihat contoh lebih banyak di bawah ini.
Contoh
Contoh 1
guna offset
Atribut singkat untuk mengatur nilai offset-path, offset-distance dan offset-rotate untuk elemen <img>:
img { offset: path('M 50 80 C 150 -20 250 180 350 80') 150px auto 45deg; }
Contoh 2: offset-path dan offset-rotate
使用 <img> 元素的 offset
Tetapkan nilai atribut offset-path dan offset-rotate:
img { offset: path('M 50 80 C 150 -20 250 180 350 80') 45deg; }
Contoh 3: offset-path dan offset-distance
使用 <img> 元素的 offset
Tetapkan nilai atribut offset-path dan offset-distance:
img { offset: path('M 50 80 C 150 -20 250 180 350 80') 150px; }
例子 4:offset-path、offset-distance、offset-rotate 和 offset-anchor
使用 <img> 元素的 offset
属性设置 offset-path、offset-distance、offset-rotate 和 offset-anchor 的属性值:
img { offset: path('M 50 80 C 150 -20 250 180 350 80') 150px -90deg / 0% 50%; }
CSS 语法
offset: auto|value|initial|inherit;
属性值
值 | 描述 |
---|---|
auto | 默认。请参阅每个单独的 'offset-' 属性的默认值。 |
offset-anchor | 指定元素上固定在动画路径上的点。默认值为 auto。 |
offset-distance | 指定从 offset-path 定义的路径起点开始的距离。默认值为 0。 |
offset-path | 指定元素动画化的路径。默认值为 none。 |
offset-position | 指定元素沿路径的初始位置。默认值为 normal。 |
offset-rotate | 指定元素沿路径动画化时的旋转角度。默认值为 auto。 |
initial | 将此属性设置为其默认值。参阅 initial。 |
inherit | 从其父元素继承此属性。参阅 inherit。 |
技术细节
默认值: | See the default value for the individual properties |
---|---|
继承性: | 否 |
动画制作: | 支持。请参阅:动画相关属性。 |
版本: | CSS3 |
JavaScript 语法: | object.style.offset="path('M 50,250 C 700,-50 -400,-50 250,250') 200px auto 90deg" |
浏览器支持
表格中的数字表示首个完全支持该属性的浏览器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
55 | 79 | 72 | 16 | 42 |
相关页面
Panduan:Laluan SVG
Panduan:Aniما CSS
Rujukan:Sifat offset CSS
Rujukan:Sifat offset-anchor CSS
Rujukan:Sifat offset-distance CSS
Rujukan:Sifat offset-path CSS
Rujukan:Sifat offset-position CSS
Rujukan:Sifat offset-rotate CSS
- Hal sebelumnya object-position
- Hal berikutnya offset-anchor