CSS offset-position ਵਿਸ਼ੇਸ਼ਤਾ

ਪਰਿਭਾਸ਼ਾ ਅਤੇ ਵਰਤੋਂ

offset-position ਪ੍ਰਤੀਭਾਵ ਇਲੀਮੈਂਟ ਦਾ ਮੂਲ ਸਥਾਨ ਪਾਠ ਸਫਰ 'ਤੇ ਨਿਰਧਾਰਤ ਕਰਦਾ ਹੈ。

ਜੇਕਰ offset-path ਜੇਕਰ ਫੰਕਸ਼ਨ ਆਪਣੇ ਆਪ ਦਾ ਮੂਲ ਸਥਾਨ ਨਹੀਂ ਨਿਰਧਾਰਤ ਕਰਦਾ ਤਾਂ offset-position ਦਾ ਮੂਲ ਸਥਾਨ ਪਹਿਲਾਂ ਪਾਠ ਸਫਰ ਉੱਤੇ ਸਫਰ ਕਰਨ ਵਾਲੇ ਇਲੀਮੈਂਟ ਦੇ ਮੂਲ ਸਥਾਨ ਨੂੰ ਨਿਰਧਾਰਤ ਕਰਦਾ ਹੈ。

ਮਿਸ਼ਰਣ

ਉਦਾਹਰਣ 1

ਸਪੱਸ਼ਟ ਐਲੀਮੈਂਟ ਦਾ ਮੂਲ ਸਥਾਨ ਦਾਇਰਾ ਦੇ ਨਿਚਲੇ ਉੱਪਰ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ:

#square {
  width: 60px;
  height: 60px;
  background: blue;
  offset-position: bottom right;
  offset-path: ray(45deg);
}

亲自试一试

例子 2

查看不同的偏移起始位置:

#square1 {
  width: 40px;
  height: 40px;
  background: pink;
  text-align:center;
  offset-position: bottom right;
  offset-path: ray(45deg);
}
#square2 {
  width: 40px;
  height: 40px;
  background: red;
  text-align:center;
  offset-position: top right;
  offset-path: ray(25deg);
}
#square3 {
  width: 40px;
  height: 40px;
  background: yellow;
  text-align:center;
  offset-position: normal;
  offset-path: ray(45deg);
}
#square4 {
  width: 40px;
  height: 40px;
  background: cyan;
  text-align:center;
  offset-position: auto;
  offset-path: ray(95deg);
}
#square5 {
  width: 40px;
  height: 40px;
  background: lavender;
  text-align:center;
  offset-position: 30% 70%;
  offset-path: ray(120deg);
}

亲自试一试

CSS 语法

offset-position: auto|normal|position|initial|inherit;

属性值

描述
normal 将偏移起始位置设置为包含块的 50% 50%。默认值。
auto 将偏移起始位置设置为元素框的左上角。
position

指定一个 x/y 坐标,将元素相对于其框边缘放置。

可以使用 1 到 4 个值来定义位置。

initial 将此属性设置为其默认值。参阅 initial
inherit 从其父元素继承此属性。参阅 inherit

技术细节

默认值: normal
继承性:
动画制作: 支持。请参阅:动画相关属性
版本: CSS3
JavaScript 语法: object.style.offsetPosition="auto"

浏览器支持

表格中的数字表示首个完全支持该属性的浏览器版本。

Chrome Edge Firefox Safari Opera
116 116 122 16 102

ਸਬੰਧਤ ਪੰਨੇ

ਟੂਟੀਕਲ:SVG ਪਾਥ

ਟੂਟੀਕਲ:CSS ਐਨੀਮੇਸ਼ਨ

ਸਬੰਧਤ:CSS offset ਵਿਸ਼ੇਸ਼ਤਾ

ਸਬੰਧਤ:CSS offset-anchor ਵਿਸ਼ੇਸ਼ਤਾ

ਸਬੰਧਤ:CSS offset-distance ਵਿਸ਼ੇਸ਼ਤਾ

ਸਬੰਧਤ:CSS offset-path ਵਿਸ਼ੇਸ਼ਤਾ

ਸਬੰਧਤ:CSS offset-rotate ਵਿਸ਼ੇਸ਼ਤਾ