How do I keep two side-by-side divs the same height?

后端 未结 22 2768
自闭症患者
自闭症患者 2020-11-21 07:56

I have two divs side by side. I\'d like the height of them to be the same, and stay the same if one of them resizes. I can\'t figure this one out though. Ideas?

To c

22条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-21 08:02

    The Fiddle

    HTML

    Hello Kitty!

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium cum accusamus ab nostrum sit laborum eligendi, totam nam aperiam harum officia commodi tempora dolorum. Incidunt earum explicabo deleniti architecto illo!

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium cum accusamus ab nostrum sit laborum eligendi, totam nam aperiam harum officia commodi tempora dolorum. Incidunt earum explicabo deleniti architecto illo!

    CSS

    .container {
        float: left;
        width: 100%;
        background-color: black;
        position: relative;
        left: 0;
    }
    
    .container:before,
    .container:after {
        content: " ";
        display: table;
    }
    
    .container:after {
        clear: both;
    }
    
    .left-column {
        float: left;
        width: 30%;
        height: 100%;
        position: absolute;
        background: wheat;
    }
    
    .right-column {
        float: right;
        width: 70%;
        position: relative;
        padding: 0;
        margin: 0;
        background: rebeccapurple;            
    }
    

提交回复
热议问题