This example visually compares various initial offset starting position of an element when ray()
is used to specify a value for the offset-path
property. The number inside the element box indicates the element to which CSS is applied as well as the element's anchor point.
.box {
background-color: green;
border-top: 6px dashed white;
background-clip: border-box;
position: absolute;
top: 20px;
left: 20px;
opacity: 20%;
color: white;
}
.box0 {
offset-position: normal;
}
.box1 {
offset-position: normal;
offset-path: ray(0deg);
}
.box2 {
offset-position: auto;
offset-path: ray(0deg);
}
.box3 {
offset-position: left top;
offset-path: ray(0deg);
}
.box4 {
offset-position: 30% 70%;
offset-path: ray(120deg);
}
Result
In box0
, the absence of the offset-path
property means that an offset-position
of either normal
or auto
has no effect. When offset-position
is normal
, the ray starts at the center of the containing block (i.e., 50% 50%
). This is the default starting position of an offset path and is used when no offset-position
is specified. Notice the difference between offset starting positions auto
and left top
. The value auto
aligns the element's anchor point to its own top-left corner, whereas the value left top
aligns the element's anchor point to the top-left corner of the containing block.