Во-первых, вы применяете отрицательное поле к неправильному элементу.Вы должны применить его к первому ребенку после .hero
.
К .about-inner
.
Кроме того, ваша техника вертикального центрирования, используемая во втором разделе, которая центрирует два элемента в пространстве полной высоты области просмотра, влияет на это на более широких (и более высоких) экранах.Чтобы отключить его, просто удалите min-height
из .main-outer
:
body {
margin: 0;
font-family: 'Montserrat', serif;
}
h1 {
font-size: 1.5em;
font-weight: 600;
}
h6 {
font-family: 'Montserrat', serif;
font-size: 0.8em;
font-weight: 200;
display: block;
text-align: center;
}
.header {
height: 80px;
display: flex;
justify-content: left;
/* align horizontal */
align-items: center;
/* align vertical */
}
.hero {
/* Sizing */
width: 100%;
min-height: 60vh;
/* Flexbox Stuff */
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 50px;
/* Text styles */
text-align: center;
/* Background styles */
background-color: red;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
}
.flex-container {
display: flex;
flex-flow: row wrap;
justify-content: center;
background: white;
padding: 5px;
}
.flex-container>* {
margin: auto;
}
.flex-container img {
display: block;
width: 150px;
height: auto;
margin: 5px;
}
.main-outer {
display: flex;
justify-content: center;
flex-direction: column;
justify-content: safe center;
align-items: center;
background-color: #eeeeee;
position: relative;
box-sizing: border-box;
padding-bottom: 50px;
}
.main-outer>* {
width: 80vw;
box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .1), 0 5px 8px 0 rgba(0, 0, 0, .07), 0 1px 14px 0 rgba(0, 0, 0, .06)
}
.about-inner {
margin-top: -50px;
margin-bottom: 10px;
width: 80vw;
background-color: white;
display: inline-block;
justify-content: center;
align-items: center;
text-align: center;
}
.clients-inner {
background-color: white;
display: inline-block;
justify-content: center;
align-items: center;
text-align: center;
}
.about-inner h3,
.clients-inner h3 {
font-size: 1.5em;
font-weight: 600;
padding-top: 10px;
letter-spacing: 0.1em;
}
.about-inner p,
.clients-inner p {
font-size: 1em;
font-weight: 300;
text-align: left;
padding: 0 10vw 1em;
line-height: 2em;
}
.hero h1 {
/* Text styles */
font-size: 3em;
color: white;
/* Margins */
margin-bottom: 0.5em;
padding: 20px;
}
<section class="hero">
<div class="hero-inner">
<h1>Lorem ipsum<br>dolor sit amet.</h1>
</div>
</section>
<div class="main-outer">
<div class="about-inner">
<h3>「 About 」</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p>
</div>
<div class="clients-inner">
<h3>「 Clients 」</h3>
<div class="flex-container">
<div>
<img src="./Assets/Clients/logo.jpg" alt="1" />
</div>
<div>
<img src="./Assets/Clients/logo.jpg" alt="2" />
</div>
<div>
<img src="./Assets/Clients/logo.jpg" alt="3" />
</div>
<div>
<img src="./Assets/Clients/logo.jpg" alt="4" />
</div>
<div>
<img src="./Assets/Clients/logo.jpg" alt="5" />
</div>
</div>
</div>
</div>
Я также применил еще несколько настроек:
- изменено
100px
горизонтальное заполнение до 10vw
- добавил немного
bottom-padding
к hero
, чтобы противостоять отрицательному полю следующего элемента - использовал
100%
как ширину .hero
вместо 100vw
, чтобы избавиться от горизонталиbar (что вызвано body
наличием поля во фрагментах переполнения стека). - применил мягкое
box-shadow
к элементам, подобным карточке