Two column layout with one having a fixed width in CSS

前端 未结 5 1373
我寻月下人不归
我寻月下人不归 2020-12-20 10:12

I want a nice 2 column layout using CSS float\'s.

Column#1 160 px Column#2 100% (i.e. the rest of the space).

I want to place the Col#2\'s div first, so my l

5条回答
  •  情深已故
    2020-12-20 10:28

    Neither of the above will work.

    div#col2 {
        width: 160px;
        float: left;
        position: relative;
    }
    
    div#col1 {
        width:100%;
        margin-left: 160px;
    }
    

    That's assuming that Column 2 should appear as a left sidebar, with col 1 as the main content.

提交回复
热议问题