Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] 第630天 实现两列等宽布局的方式有哪些? #3393

Open
haizhilin2013 opened this issue Jan 4, 2021 · 4 comments
Open
Labels
html html

Comments

@haizhilin2013
Copy link
Collaborator

第630天 实现两列等宽布局的方式有哪些?

3+1官网

我也要出题

@haizhilin2013 haizhilin2013 added the html html label Jan 4, 2021
@GeassAthena
Copy link

1.flex实现:
.parent {
display: flex;
}
.child {
flex: 1;
width: 50%;
}
2.float实现(但是要注意清除浮动):
.child {
float: left;
width: 50%;
}

@liurubin
Copy link

liurubin commented Jan 5, 2021

.parent{ display:grid; grid-template-columns:repeat(2,50%); height:100px; }

@GeJJ
Copy link

GeJJ commented Jan 5, 2021

1.绝对定位

.position-wrap{ height: 20px; position: relative; } .position-left{ position: absolute; left: 0; width: 50%; height: 100%; background: red; } .position-right{ position: absolute; left: 50%; width: 50%; height: 100%; background: royalblue; } 2.table
.table-wrap{ display: table; height: 20px; width: 100%; } .table-left{ height: 20px; background: red; display: table-cell; } .table-right{ height: 20px; background: royalblue; display: table-cell; }

@wu529778790
Copy link

.parent {
display: flex;
}
.child {
flex: 1;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html html
Projects
None yet
Development

No branches or pull requests

5 participants