Horizontally & Vertically centering 2 divs within two side by side 50% width columns

前端 未结 1 450
北荒
北荒 2021-01-16 16:28

Having some trouble getting 2 divs to center horizontally & vertically within their respective parents which are side by side with 50% width and 100% height.

Her

相关标签:
1条回答
  • 2021-01-16 17:04

    I tried this. I'm not sure if this is what you are looking for. I added display: flex; to the .left and .right classes.

    .parent {
        height: 100%;
        width: 100%;
    }
    
    .left, .right {
        float: left;
        height: 500px;
        width: 50%;
        display: flex;
    }
    
    .info {
        width: 400px;
        height: 280px;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        margin: auto;
    }
    
    0 讨论(0)
提交回复
热议问题