CSS: How to have to divs side by side with height 100%?

后端 未结 4 2023
甜味超标
甜味超标 2021-01-03 09:48

I am trying to create a two div\'s side by side that fill my screen 100%. The left div contains some menu and the right the content. Here\'s the code I have at the moment:

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 10:30

    I have ran in the same problem so many times, until I found this: http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks

    It is a valid CSS solution for making your colums share the height. Then both will be the height of the largest column.

    If you want to make your colums fill the whole screen you could use something like

    .innerLeft {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 50%; 
    }
    
    .innerRight {
        position: absolute;
        left: 50%;
        top: 0;
        bottom: 0;
        right: 0; 
    }
    

提交回复
热议问题