html - How do I first center an image and then vertically center text on either side of that image? -


i want 2 things:

  1. center image on page horizontally.
  2. write text on both sides of image.
    • on right side, text should left-aligned, , on left side, should right-aligned.
    • each chunk of text should vertically centered respect image.

here's code i've got far, can't quite work:

<div>      <div style="vertical-align: middle; float: left; text-align: right;">          <strong style="font-size: large;">credentials</strong>          <ul>              <li>dsadsad</li>              <li>cxzcxzc</li>              <li>hgfhgfhg</li>              <li>uytuty</li>              <li>eqwewqeqwewq</li>          </ul>      </div>        <div style="text-align: center; display: inline-block;">          <a href="https://i.imgur.com/xilprn5.jpg"><img style="height: 400px; width: auto;" src="https://i.imgur.com/xilprn5.jpg" /></a>      </div>        <div style="vertical-align: middle; float: left; text-align: left;">          <strong style="font-size: large;">likes</strong>          <ul>              <li>dsadsadsa</li>              <li>cxzcxzc</li>              <li>gdgfdgfdgdf</li>              <li>jhjghjhgj</li>              <li>ouioiuoiuo</li>              <li>..,m/.m,.m,</li>              <li>opupoiuyuyi</li>              <li>adsaeqw421312</li>              <li>4356436546</li>          </ul>      </div>  </div>

how can fix achieve want? thanks!

here 1 way using display flex on parent element.

.row {      display: flex;      align-items: center;      justify-content: center;      position: relative;  }  .clear {      clear:both;  }  .clear:before, .clear:after {      content:"";      display:table;  }  .clear:after { clear:both; }  .column {      float: left;      width: 33.333%;      border: 1px solid #ccc;      box-sizing: border-box;      text-align: center;  }  .column img {      max-width: 100%;  }  .column:first-of-type {      text-align: right;  }  .column:last-of-type {      text-align: left;  }
<div class="row clear">      <div class="column">          <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. quae magnam distinctio vel necessitatibus vero quaerat soluta ducimus, amet minima consequuntur nulla! inventore maiores suscipit minus animi corporis porro illo quaerat!</p>      </div>      <div class="column">          <img src="http://i.imgur.com/i9qj2wp.png">      </div>      <div class="column">          <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. quae magnam distinctio vel necessitatibus vero quaerat soluta ducimus, amet minima consequuntur nulla! inventore maiores suscipit minus animi corporis porro illo quaerat!</p>      </div>  </div>


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -