How to realize two-column layout in html
This article is about how to implement a two-column layout in html. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The method of realizing two-column layout in html: 1, using float attribute and margin attribute to realize; 2, using BFC technology to realize; 3, using table layout technology to realize; 4, using flex elastic layout technology to realize; 5, using grid grid layout technology to realize.
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
Implementation of two-column layout in html web pages
1. Using float+margin to realize
Document.left1 {height: 300px _ politics _ float: red;width: 400px _ politics float: left;}. Right1 {width: 400px _ politics height: 300px _ politics _ backgroundlycolor: green;margin-left: 400px;}
2. Using BFC to realize
Document.left2 {height: 300pxpolitic backgroundlycolor: red;width: 400pxpolitic float: left;}. Right2 {height: 300pxTracing backgroundmurycolor: blue;overflow: hidden;}
3. Make use of table layout
Document.parent {display: table;width: 100% display layout: fixed;}. Left3 {display: table-cell;height: 300pxscape width: 300pxpolitical width: 300pxpolitical backgroundcolor: pink;}. Right3 {display: table-cell;height: 300pxparty backgroundcolor: purple;}
4. Using flex layout
Document.parentf {display: flex;flex-direction: row;justify-content: flex-start;width: 100%;} .left4 {height: 300pxash width: 300pxpolitic right4: skyblue;}. Right4 {height: 300pxuckwidth: 100% Landscape: yellowgreen;}
5. Make use of grid layout
Document.parent {height: 400pxposition display: grid;grid-template-columns: 50% 50% width: 100%;}. Left5 {background-color: skyblue;}. Right5 {background-color: pink;} Thank you for reading! This is the end of the article on "how to achieve two-column layout in html". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!