1

От начала экрана или начала элемента?

4
  • Но так не происходит!!! (((
    – sergei1980
    18 апр 2020 в 12:29
  • от левого верхнего края окна браузера....
    – Air
    18 апр 2020 в 12:30
  • @Air точно - сорри 18 апр 2020 в 12:39
  • А если возможность сделать что бы от конкретного элемента он высчитвал
    – sergei1980
    18 апр 2020 в 12:42

1 ответ 1

3

от левого верхнего края окна браузера...

* {
  margin: 0;
  padding: 0;
}

html,
body {
  position: relative;
  height: 50vh;
  width: 90vw;
  left: 50px;
  top: 50px;
  background-color: red;
}

body {
  left: 100px;
  top: 100px;
  background-color: green;
}

div {
  position: absolute;
  width: 90%;
  height: 40vh;
  left: 50px;
  top: 50px;
  background-color: orange;
  background-image: url(https://avatars.mds.yandex.net/get-pdb/1636783/96989b87-2116-4678-a8ee-ae113469504d/s1200?webp=false);
  background-attachment: fixed;
  background-position: 205px 205px;
  background-repeat: no-repeat;
}
<div></div>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.