https://codepen.io/Eugene-73/pen/mybEbMW
body {
display: flex;
}
.section {
width: 1260px;
}
.speakers {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.speaker {
width: 418px;
/* Если поставить 420px то 3 столбец съедет вниз, почему так??? Эти 2 пикселя от бордера, почему эти пискели не входят в 420px????*/
box-sizing: border-box;
/* Почему не работает????*/
display: block;
}
<section class="section">
<h2 class="section-title">Наши эксперты</h2>
<div class="speakers">
<div class="speaker">
<img src="https://netology-code.github.io/html-2-homeworks/block-elements-positioning/our-experts-section/img/6211.jpg" class="speaker-photo" alt>
<span class="speaker-name">Татьяна Тен</span>
</div>
<div class="speaker">
<img src="https://netology-code.github.io/html-2-homeworks/block-elements-positioning/our-experts-section/img/18702.jpeg" class="speaker-photo" alt>
<span class="speaker-name">Денис Ежков</span>
</div>
<div class="speaker">
<img src="https://netology-code.github.io/html-2-homeworks/block-elements-positioning/our-experts-section/img/18292.jpeg" class="speaker-photo" alt>
<span class="speaker-name">Андрей Батусов</span>
</div>
<div class="speaker">
<img src="https://netology-code.github.io/html-2-homeworks/block-elements-positioning/our-experts-section/img/16689.jpeg" class="speaker-photo" alt>
<span class="speaker-name">Александр Беспоясов</span>
</div>
<div class="speaker">
<img src="https://netology-code.github.io/html-2-homeworks/block-elements-positioning/our-experts-section/img/9998.jpeg" class="speaker-photo" alt>
<span class="speaker-name">Константин Фокин</span>
</div>
<div class="speaker">
<img src="https://netology-code.github.io/html-2-homeworks/block-elements-positioning/our-experts-section/img/19697.jpeg" class="speaker-photo" alt>
<span class="speaker-name">Виталий Гусаров</span>
</div>
</div>
</section>
The problem is that box-sizing: border-box does not work; and the blocks shift down if you set the width to 420px
If you set the width to 420px, the blocks shift downwards, Why is that??
How can this be explained?
New contributor
Johnny Mor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4