Search code examples
htmlcssalignmentvertical-alignment

CSS vertical align based on height of other element


I'm trying to create a block with an image that contains content by your side, where I intend to align the image vertically based on the content's height. I've tried alignments with table/table-cell technique but I can't get what I want..

click here to see what I want:

enter image description here


Solution

  • This solve my question without using flex-box, I need it works in old browsers

    .container {
      position: relative;
      background:#eee;
      padding: 20px 20px 20px 450px;
    }
    img {
       position:absolute;
        left:0;
        top:50%;
        margin-top:-100px;
    }