html中实现两栏布局的方法:1、利用float属性和margin属性来实现;2、利用BFC技术来实现;3、利用table布局技术来实现;4、利用flex弹性布局技术来实现;5、利用grid网格布局技术来实现。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
html网页中实现两栏布局
1、利用float+margin实现
Document .left1 {height: 300px;background-color: red;width: 400px;float: left;}.right1 {width: 400px;height: 300px;background-color: green;margin-left: 400px;}
2、利用BFC实现
Document .left2 {height: 300px;background-color: red;width: 400px;float: left;}.right2 {height: 300px;background-color: blue;overflow: hidden;}
3、利用table布局
立即学习“前端免费学习笔记(深入)”;
Document .parent {display: table;width: 100%;table-layout: fixed;}.left3 {display: table-cell;height: 300px;width: 300px;background-color: pink;}.right3 {display: table-cell;height: 300px;background-color: purple;}
4、利用flex布局
Document .parentf {display: flex;flex-direction: row;justify-content: flex-start;width: 100%;}.left4 {height: 300px;width: 300px;background-color: skyblue;}.right4 {height: 300px;width: 100%;background-color: yellowgreen;}
5、利用grid布局
Document .parent {height: 400px;display: grid;grid-template-columns: 50% 50%;width: 100%;}.left5 {background-color: skyblue;}.right5 {background-color: pink;}
推荐教程:html视频教程、css视频教程
以上就是html中怎么实现两栏布局的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1550775.html
微信扫一扫
支付宝扫一扫