0

body, h1, h2,h3,h4, p,a {
  margin: 0;
  font-size: 100%;
  font-weight: normal;
}

body {
  font-family: 'PTRootUI', 'Arial', sans-serif;
}

@font-face {
src: url(fonts/PTRootUI-Light.woff);
font-family: "PTRootUI";
font-weight: lighter;
}

@font-face {
src:url(land/Jost-ExtraBold.woff);
font-family: "Jost";
font-weight: bold;
}

* {box-sizing: border-box;}

.header {display:flex;
height: 100px;}

.textheader {
font-size: 30px;
color:white;
font-family: "PTRootUI";
text-transform: uppercase;
margin-left: 55px;
}

.firstpage {
background: url(../../img/photo.webp);
height:100vh;
background-repeat:no-repeat;
background-position: center;
background-size: cover;
}

.opacityfirstpage {width: 100%;
height:100%;
background-color: rgba(0, 0, 0, .4)}
<!DOCTYPE html>
<html lang="ru">
<head>
    <link rel="stylesheet" href="assets/css/style.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Landing page</title>
    <link rel="icon" type="image" href="https://code.s3.yandex.net/web-code/js-favicon.ico">
</head>
<body>
    <div class="firstpage">
        <div class="opacityfirstpage">
          <header class="header">
            <p class="textheader">test</p>
          </header>
          </div>
    </div>
</body>
</html>

не добавляется картинка в css, все уже испробовал

2 ответа 2

1

Внутри url нужно ставить кавычки после скобок.

1
  • Не путайте background и background-image
    – Arcadiy
    28 фев 2021 в 15:26
0

Возможно путь к изображению неверный. Если у вас папка img находится рядом с css, то путь должен быть следующий:

.firstpage {
  background: url('../img/photo.webp') center/cover no-repeat;
  height: 100vh;
}

Ваш ответ

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

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