Адаптивный background html css
Что делать если при изменении разрешения фона картинка перестаёт уменьшаться пропорционально экрану и оставляет белое пространство? Codepen
@import url("https://fonts.googleapis.com/css2?family=Kaushan+Script&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
#html {
width: 100%;
height: 100vh;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#home_page {
font-family: "Montserrat", sans-serif;
width: 100%;
height: 100%;
}
#home_page .section-header {
background: linear-gradient(
rgba(0, 0, 0, 1) 0%,
rgba(0, 255, 247, 0.089) 50%,
rgba(0, 0, 0, 1) 100%
),
url(https://i.postimg.cc/6pjW079H/231132323231123.png);
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
height: 100vh;
max-width: 100vw;
max-height: 100vh;
}
#home_page .logo {
transform: translate(-200px, 0);
}
.container {
margin: 0 auto;
width: 1200px;
}
#home_page .section-header .container {
display: flex;
justify-content: center;
align-items: center;
align-items: center;
}
#home_page .section-header .container .menu {
display: flex;
justify-content: end;
padding: 20px 0;
}
#home_page .section-header .container .menu a {
/* здесь был padding - надо убрать его*/
color: white;
text-decoration: none;
font-size: 16px;
font-weight: 500;
}
#home_page .section-header .container .menu .item {
margin-left: 20px;
}
#home_page .section-header .container .logo {
color: white;
font-size: 24px;
font-weight: 700;
}
#home_page .section-header .container:nth-child(2) {
flex-direction: column;
align-items: center;
text-align: center;
color: #fff;
}
#home_page .section-header .container:nth-child(2) h2 {
font-family: Kaushan Script, sans-serif;
font-size: 4.5rem;
margin-top: 170px;
font-weight: 400;
}
@keyframes flicker {
0%,
18%,
22%,
25%,
53%,
57%,
100% {
text-shadow: 0 0 1px #00f7ff, 0 0 2px #00f7ff, 0 0 5px #00f7ff,
0 0 11px #00f7ff, 0 0 20px #00f7ff, 0 0 30px #00f7ff, 0 0 55px #00f7ff,
0 0 80px #00f7ff;
}
20%,
24%,
55% {
text-shadow: none;
}
}
#home_page .section-header .container:nth-child(2) h1 {
font-family: Montserrat, sans-serif;
font-size: 9.375rem;
margin-top: 65px;
text-transform: uppercase;
font-weight: 600;
letter-spacing: -5px;
line-height: 140px;
transform: translate(0, -100px);
animation: flicker 1.5s infinite alternate;
}
#home_page .section-header .container:nth-child(2) .line {
margin-top: 40px;
width: 20%;
height: 4px;
background-color: #fff;
transform: translate(0, -100px);
}
#home_page .section-header .container:nth-child(2) .button {
transition: 0.2s;
padding: 10px 20px;
color: #fff;
font-size: 0.875rem;
font-family: Montserrat, sans-serif;
text-decoration: none;
border: 4px solid #fff;
text-transform: uppercase;
margin-top: 40px;
font-weight: 700;
border: 8px solid #00f7ff;
transform: translate(0, -100px);
box-shadow: 0 0 1px #00eeffec, 0 0 2px #00eeffd7, 0 0 6px #00eeff,
0 0 12px #00eeffbe, inset 0 0 1px #00eeffa2, inset 0 0 2px #00eeff86,
inset 0 0 6px #00eeff60, inset 0 0 12px #00eeff33;
}
#home_page .section-header .container:nth-child(3) {
color: white;
font-family: Montserrat, sans-serif;
}
#home_page .section-header .container:nth-child(3) .row {
margin-top: 100px;
justify-content: space-between;
padding-bottom: 20px;
}
#home_page .section-header .container:nth-child(3) .row .col-3 {
width: 23%;
}
#home_page .section-header .container .hhh {
scale: 20%;
}
#home_page .section-header .container:nth-child(3) .row .col-3 .line {
width: 100%;
height: 4px;
background-color: #fff;
}
#home_page .section-header .container:nth-child(3) .row .col-3 .text {
display: flex;
align-items: baseline;
}
#home_page .section-header .container:nth-child(3) .row .col-3 .text h2 {
margin-right: 10px;
font-size: 2rem;
}
#home_page .section-header .container:nth-child(3) .row .col-3 .text h3 {
font-size: 1.5rem;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Главная</title>
<link rel="stylesheet" href="./assets/styles/style.css">
</head>
<body id="home_page">
<div class="section-header">
<div class="container">
</div>
<div class="container">
<div class="text-block">
<h2 class="kaushan"></h2>
<h1> Welcome </h1>
</div>
<a href="#vvs" class="button">
Learn
</a>
</div>
<div class="container">
<div class="row">
</div>
</div>
</div>
</body>
</html>