当前位置:网站首页>flex三列布局
flex三列布局
2022-07-26 08:10:00 【MonsterQy】
背景
提起三列
布局大家应该都会想到:左右固定宽高,中间自适应的(比如说圣杯布局、双飞翼布局…)但其实有的时候在项目中我们往往会遇到另一类三列布局:中间固定宽高、左右自适应的三列布局页面。第一类三列布局的实现多种多样,但自从css3中出现了flex布局之后,通过flex布局的实现广受好评。
实现:
第一类的flex实现代码如下(左右固定宽高,中间自适应的):
html结构:
<div class='wrap'>
<div class='left'></div>
<div class='center'></div>
<div class='right'></div>
</div>
css代码:
.wrap{
display:flex;
}
.left,.right{
flex-grow: 1;
}
.center{
width:1200px;
}
第二类的flex实现代码如下(中间固定宽高、左右自适应的):
html结构:
<div class='wrap'>
<div class='left'></div>
<div class='center'></div>
<div class='right'></div>
</div>
css代码:
.wrap{
display:flex;
}
.left,{
order: -1;
flex: 0 0 100px;
}
.right{
flex: 0 0 100px;
}
.center{
flex-grow: 1;
}
总结:
flex布局实现三列响应式的核心点其实就在于对想要具有响应式特性的div设置flex-grow:;
边栏推荐
- 2022-07-08 group 5 Gu Xiangquan's learning notes day01
- Summary of traversal methods of list, set, map, queue, deque and stack
- table 固定特定行
- Excel file reading and writing (creation and parsing)
- The difference between abstract classes and interfaces
- C# 获取选择文件信息
- Traversal mode of list, set, map, queue, deque, stack
- 2022-07-13 group 5 Gu Xiangquan's learning notes day06
- CentOS install mysql5.7
- Summary of distributed related interview questions
猜你喜欢

美女裸聊一时爽,裸聊结束火葬场!

The idea of stack simulating queue

Pycharm code specification tool flake8

Excel file reading and writing (creation and parsing)

Idea settings set shortcut keys to convert English letters to case in strings

Unity Metaverse(二)、Mixamo & Animator 混合树与动画融合

宇宙第一 IDE 霸主,换人了。。。

Table fix specific rows

Burp Suite-第九章 如何使用Burp Repeater

数组的介绍--Array
随机推荐
OSPF总结
If the thread crashes, why doesn't it cause the JVM to crash? What about the main thread?
Idea settings set shortcut keys to convert English letters to case in strings
[fastjson1.2.24 deserialization vulnerability principle code analysis]
JSP implicit object servlet object
有点牛逼,一个月13万+
"Door lock" ignites a heated discussion on the safety of living alone. The new poster picture is suffocating
IDEA settings设置快捷键实现字符串中的英文字母转大小写
Lnmp+wordpress to quickly build a personal website
Dev gridcontrol 捕获按键事件
Distributed system and distributed database system (Introduction)
2022-07-08 group 5 Gu Xiangquan's learning notes day01
2022/7/12 exam summary
The bigger the project is, the bigger it is. This is how I split it
C # get the information of the selected file
JSP action -- usebean action
Burp Suite - Chapter 1 burp suite installation and environment configuration
Summary of common methods of string
2W word detailed data Lake: concept, characteristics, architecture and cases
Stm8 official library file download