Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74406

How to center content, vertically and horizontally, in inline-block-div?

$
0
0

After making two div elements inline-block, and then vertical-align: top, I'm left with an image which was originally centered both vertically and horizontally within the div, at the top left-hand side. Here is the code:

.soundscapeImgDiv {
  /* background-color: white; */
  background-image: url('../images/testImg.png');
  background-size: 100%;
  background-repeat: no-repeat;
  width: 260px;
  height: 85%;
  margin-left: 10px;
  margin-top: 12px;
  border-radius: 12px;
  /* text-align: center; */
  display: flex;
  align-items: center;
  justify-content: center;
  display: inline-block;
  vertical-align: top;
}

.portalInfoDiv {
  background-color: White;
  margin-left: 10px;
  height: 71px;
  width: 56%;
  display: inline-block;
  vertical-align: top;
}
<div class="bottomPlayerDiv"><div class="soundscapeImgDiv"><!-- <div class="playerDiv"> --><img id="pause/playIcon" src="images/pause.png"><!-- </div> --><!-- <img id="soundscapeImg" src="images/testImg.png" width="100%"> --><!-- <img id="pause/playIcon" src="images/pause.png"> --></div><div class="portalInfoDiv"><h1>Shanghai, China night lols</h1><p>somethingsGuy • 5 days ago</p></div></div>

How can I center it like before?

Current Vs intended: enter image description here

enter image description here


Viewing all articles
Browse latest Browse all 74406

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>