flexbox子盒子flex属性
2024-09-18 09:26:23
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.flex-container {
display: flex;
height: 400px;
background-color: gray;
}
.flex-item {
background-color: green;
width: 100px;
height: 100px;
margin: 5px;
/*flex属性是flex-grow, flex-shrink 和 flex-basis的简写,默认值为0 1 auto*/
/*flex: auto即flex:1 1 auto;各个子盒子均等分*/
/*flex: auto;*/
/*flex: none即flex:0 0 auto;子盒子将不具有伸缩性*/
/*flex:none;*/
}
/*flex:[number],子盒子按比例分割*/
.flex-item:nth-child(1) {
flex: 2
}
.flex-item:nth-child(2) {
flex: 1
}
.flex-item:nth-child(3) {
flex: 1
}
</style>
</head>
<body>
<div class="flex-container">
<div class="flex-item">flex item 1</div>
<div class="flex-item">flex item 2</div>
<div class="flex-item">flex item 3</div>
</div>
</body>
</html>
最新文章
- 用ElasticSearch和Protovis实现数据可视化
- php的Excel相关操作
- morris.js 简单学习
- vim使用指北 ---- Global Replacement
- 判断浏览器IE6
- SVN最有效的方法打基线
- 【leetcode78】Single Number II
- 24分钟让AI跑起飞车类游戏
- 图片上传组件webuploader
- iOS推送证书生成pem文件(详细步骤)
- 用OpenGL实现动态的立体时钟
- boot中 Quartz注入spring管理类失败
- 20155210 Exp2 后门原理与实践
- spring定时任务注解@Scheduled的记录
- react native基础与入门
- linux清空文件方法
- P4168 [Violet]蒲公英 区间众数
- CodeForces - 995B Suit and Tie
- rest_framework之访问频率控制
- request.getRequestDispatcher(url).forward(request, response)
热门文章
- 微信小程序——navigator无法跳转
- Python 文件操作三
- WinForm窗体继承
- Qt QTcpSocket 对连接服务器中断的不同情况进行判定
- chromedriver与chrome版本映射表(更新至v2.30)
- MyBatis错误:Result Maps collection already contains value for novel.storage.mapper.NovelMapper.BaseResultMap
- Android WiFi 扫描流程分析(wpa_supplicant选择网络)
- 对C语言中指针的入门理解
- 使用OpenSSL创建自己的CA root certificate
- HDU 5067 Harry And Dig Machine(状压DP)(TSP问题)