0

Не могу убрать отступ между секциями

Посмотрел в режиме разработчика нет никаких лишних отступов.

body {
  margin: 0;
  padding: 0;
}

h1 h2 h3 h4 h5 {
  margin: 0;
  padding: 0;
}

a:hover {
  transition: 0.3s;
}

.container {
  width: 80%;
  margin: 0 auto;
}

header {
  background-image: url(../img/jpg/bg.jpg);
  background-repeat: no-repeat;
  padding-top: 40px;
  padding-bottom: 150px;
}

.navbar {}

.nav {
  float: right;
  margin-top: 10px;
}

.nav a {
  text-decoration: none;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 14px;
  margin-left: 20px;
}

.nav a:hover {
  color: #b6773f;
}

.cartIcon {
  margin-left: 40px;
}

.headerTitle {
  font-family: 'Raleway', sans-serif;
  text-align: center;
  margin-top: 120px;
  color: #fff;
}

.headerTitle h2 {
  font-weight: 500;
  font-size: 36px;
  font-family: "Raleway ExtraBold";
  font-weight: ;
  margin: 0;
}

.headerTitle h1 {
  margin-top: 15px;
  margin-bottom: 20px;
  font-weight: 800;
  font-size: 52px;
}

.headerTitle p {
  font-size: 16px;
  font-weight: 300;
  width: 571px;
  margin-right: auto;
  margin-left: auto;
}

.headerButton {
  margin-top: 50px;
  text-align: center;
}

.headerButton a {
  padding: 20px 40px;
  background-color: #998675;
  border-radius: 3px;
  border-bottom: 3px solid #736357;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  font-size: 14px;
  font-family: 'Raleway', sans-serif;
  font-weight: 800;
}

.headerButton a:hover {
  background-color: #b6773f;
}

.sliderArrows {
  z-index: 2;
  /*height: 200px;*/
  background: gray;
  /* ↓↓↓ */
  position: relative;
  /* ↑↑↑ */
}

.sliderArrows .slideLeft,
.sliderArrows .slideRight {
  position: absolute;
  top: 40%;
  transform: translateY(-60%);
}

.sliderArrows .slideLeft {
  left: 0;
}

.sliderArrows .slideRight {
  right: 0;
}

.featuresItems {
  padding-top: 80px;
  padding-bottom: 80px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-row-gap: 30px;
}

.featuresItem {
  margin-top: auto;
  width: 260px;
  color: #555555;
  font-family: 'Raleway', sans-serif;
  text-align: center;
}

.featuresItem h3 {
  margin-top: 30px;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 22px;
}

.featuresItem p {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 14px;
}

.featuresDelimiter {
  width: 70px;
  height: 3px;
  background-color: #f1eee9;
  margin: 0 auto;
  margin-top: 24px;
}

.realization {
  background-color: #fbfaf8;
  padding-top: 80px;
}

.realizationTitle {
  margin: 0 auto;
  text-align: center;
  width: 770px;
}

.realizationTitle h2 {
  font-family: 'Raleway', sans-serif;
  font-size: 30px;
  font-weight: 600;
  color: #555555;
}

.realizationTitle p {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 16px;
}

.realizationBg img {
  margin-top: 30px;
  max-width: 100%;
}

.tBox {
  background: rgb(33, 27, 25);
  background: linear-gradient(90deg, rgba(33, 27, 25, 1) 0%, rgba(78, 52, 39, 1) 100%);
  padding-top: 50px;
  padding-bottom: 50px;
}

.tBoxText {}

.tBoxText h3 {
  margin: 0;
  margin-bottom: 8px;
  font-family: 'Raleway', sans-serif;
  font-size: 28px;
  font-weight: 400;
  color: #fff;
}

.tBoxText h3 span {
  color: #c7b299;
}

.tBoxText p {
  color: #615855;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 300;
}

.tBoxButton a {
  border-radius: 3px;
  text-transform: uppercase;
  text-decoration: none;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid #736357;
  color: #fff;
  background-color: #998675;
  padding: 20px 30px;
}

.tBox .container {
  display: flex;
  justify-content: space-between;
}
<section>
  <div class="realization">
    <div class="container">
      <div class="realizationTitle">
        <h2>Waxom is Realization of your Ideas.</h2>
        <p>Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium.</p>
      </div>
      <div class="realizationBg">
        <img src="img/png/realizationBg.png" alt="bg">
      </div>
    </div>
  </div>
</section>
<section>
  <div class="tBox">
    <div class="container">
      <div class="tBoxText">
        <h3><span>Waxom</span> Multipurpose WordPress Theme</h3>
        <p>Don't Forget to Rate the Template. Thanks so much!</p>
      </div>
      <div class="tBoxButton">
        <a href="   #">Purchase Now</a>
      </div>
    </div>
  </div>
</section>

2
  • В вашем представленном коде я не увидел отступа.
    – al-bulat
    15 апр 2020 в 19:15
  • Отступов я тоже не нашел. Пришлось клеить еще один костыль margin-bottom: -5px;
    – Alpan
    16 апр 2020 в 18:04

1 ответ 1

1

Нашелся ответ !

.realizationBg img{
    display: block;   //<==
    margin-top: 30px;
    max-width: 100%;
}

Причина появления отступа Весь конфуз заключается в стандартных свойствах элементов. По умолчанию тег img имеет свойства строчного элемента, что в свою очередь означает, что элемент будет выравниваться по базовой линии текста. Эта линия располагается чуть выше нижнего края блока, так как для текста существует обязательный запас- место под «хвосты» букв.

Вот где я нашел ответ: https://vaden-pro.ru/blog/css/lishnie-otstupy-img

Ваш ответ

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

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