How to properly float two columns side by side with css

前端 未结 4 1172
[愿得一人]
[愿得一人] 2020-12-29 09:20

This is one of those things I learned a long time ago and never thought much about if I was actually doing it the right way.

Let\'s say we have a structure

4条回答
  •  星月不相逢
    2020-12-29 10:14

    use display:flex for two div floats side-by-side

    #wrapper {
        width: 600px;
        display: flex;
    }
    #sideBar {
        display: inline-flex;
        width: 25%;
    }
    #mainContent {
        width: 75%;
        flex: 1;
    }
    

提交回复
热议问题