<!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>Document</title>
</head>
<body>
<div class="hat"><img src="chef.jpg" alt="" height="60"> <div class="items-hat"><p>Главная</p>
<p>Магазин</p>
<p>Контакты</p>
<p>Lorem</p></div></div>
</body>
<style>
@import url(https://fonts.googleapis.com/css?family=Montserrat:100,200,300,regular,500,600,700,800,900,100italic,200italic,300italic,italic,500italic,600italic,700italic,800italic,900italic);
*{
margin:0;
padding:0;
}
body{
height: 20000px;
}
.hat{
width: 100%;
height: 60px;
padding: 10px 0px 10px 0px;
position: fixed;
display: flex;
transition-duration: 0.2s;
background: rgb(198, 235, 255);
justify-content: space-around;
align-items: center;
}
.items-hat{
width: 500px;
font-family: Montserrat;
font-weight: 400;
cursor: pointer;
display: flex;
justify-content: space-between;
}
</style>
<script>
let hat = document.querySelector('.hat')
window.onscroll = function(){
let scroll = window.scrollY
if(scroll >= 700){
hat.style.padding = "5px 0px 5px 0px"
}
else if(scroll < 700){
hat.style.padding = "10px 0px 10px 0px"
}
}
</script>
</html>
<!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>Document</title>
</head>
<body>
<hr class="hr">
</body>
<style>
*{
margin: 0;
padding: 0;
}
html{
overflow-x: hidden;
}
body{
height: 1000px;
}
.hr{
width: 200%; margin-right: -50%;
margin-top: 20px;
}
</style>
</html>