0

Text is on center but image is not. How can i fix it?

.advantage-first__block {
  position: absolute;
  bottom: 0;
  left: 25px;
  right: 25px;
  width: 150px;
  height: 150px;
}

.advantage-first__block img {
  text-align: center;
  right: 0;
  left: 0;
  margin: 0 auto;
  width: 60px;
  height: 24px;
}

.advantage-information {
  margin: 0 auto;
  width: 129px;
  height: 76px;
  text-align: center;
  right: 0;
  left: 0;
}
<div class="advantage__info">
  <div class="advantage-first__block">
    <img class="advantage-src" src="images/advantage-car.png" alt="">
    <div class="advantage-information">
      Более 300 автомобилей в вашем распоряжении
    </div>
  </div>
</div>

Text is on center but image is not. How can i fix it?

Sfili_81
  • 2,377
  • 8
  • 27
  • 36

1 Answers1

0

Add text-align: center; in advantage-first__block

.advantage-first__block{
  position: absolute;
  bottom: 0;
  left: 25px;
  right: 25px;
  width: 150px;
  height: 150px;
  text-align: center;
  background: skyblue;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.advantage-first__block img{
  text-align: center;
  right: 0;
  left: 0;
  margin: 0 auto;
  width: 60px;
  height: 24px;
}
.advantage-information{  
  margin: 0 auto;
  width: 129px;
  height: 76px;
  text-align: center;
  right: 0;
  left: 0;
}
<div class="advantage__info">
    <div class="advantage-first__block">
        <img class="advantage-src" src="https://via.placeholder.com/50" alt="">
        <div class="advantage-information">
            Более 300 автомобилей 
            в вашем распоряжении
        </div>
    </div>
</div>
Minal Chauhan
  • 6,025
  • 8
  • 21
  • 41