Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Example Analysis of flex Multi-column layout in html

Shulou Source: shulou.com Published: 2022-05-31 12:47:41 09月23日 Update

This article mainly introduces "flex multi-column layout example analysis in html". In daily operation, I believe that many people have doubts about flex multi-column layout case analysis in html. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "flex multi-column layout example analysis in html". Next, please follow the editor to study!

Basic layout with three equal columns

.container {display: flex; width: 500px; height: 200px;} .left {flex:1; background: red;} .middle {flex:1; background: green;} .right {flex:1; background: blue;}

Three columns with fixed width on the left and adaptive on the right

.container {display: flex; height: 300px;} .left {flex: 00 100px; background-color: red;} .middle {flex: 00 100px; background-color: green;} .right {flex:1; background-color: blue;} qqq qqq wwww

After shrinking the browser window

# # fixed around, adaptive in the middle # #

.container {display: flex; height: 300px;} .left {width: 100px; background-color: red;} .middle {flex: 1; background-color: green;} .right {width: 100px; background-color: blue;} qqq qqq wwww

After shrinking the browser window

Nine palace grid layout

.container {display: flex; height: 300px; width: 300px; flex-direction: column;} .row {display: flex; height: 100px;} .left {flex: 1; height: 100px; border: 1px solid red;} .middle {flex: 1; height: 100px; border: 1px solid green } .right {flex: 1; height: 100px; border: 1px solid blue;}

Holy Grail layout

* {margin:0; padding:0;} .container {display: flex; flex-direction: column; min-height: 100vh; justify-content: space-between;} .header {background: red; flex: 00 100px;} .content {display: flex; flex:1 }. Content-left {flex: 00 100px; background: green;}. Content-right {flex: 00 100px; background: pink;}. Content-middle {flex:1;} .footer {background: yellow; flex: 00 100px;} Header Left Center Right Footer

After narrowing the browser window

At this point, the study on "flex multi-column layout instance analysis in html" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Layout example case analysis analysis learning browser browsing more help practical next ninth house right side article method theory knowledge equality article website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei MariaDB OPPO Reno macOS