Ashun's 技術駅 Ashun's 技術駅
首页
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • HTML
  • CSS
  • Vue
  • 现代web布局
  • React
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 技术资源
  • 第一阶段

    • HTML
  • 第二阶段

    • JavaScript
  • 第三阶段

    • Vue
  • 第四阶段

    • 实战项目
  • 每周测试

    • 每周
  • 其他

    • Vue引入UI框架
    • Web前端面试
    • Vue3-resource
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 福利资源
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Ashun

前端界的小学生
首页
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • HTML
  • CSS
  • Vue
  • 现代web布局
  • React
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 技术资源
  • 第一阶段

    • HTML
  • 第二阶段

    • JavaScript
  • 第三阶段

    • Vue
  • 第四阶段

    • 实战项目
  • 每周测试

    • 每周
  • 其他

    • Vue引入UI框架
    • Web前端面试
    • Vue3-resource
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 福利资源
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 01课程介绍
  • 02导入方式 - 自编译方式
  • 03导入方式 - Nuxtjs
  • 04各种字号一起看
  • 05边白与边框
  • 06定制自己的Tailwind CSS
  • 07引入我要的字体
  • 08使用 Flexbox 布局
    • 知识点
    • 官网
    • Flexbox讲解
    • 实战演习
    • 课程文件
    • 小马视频频道
    • 小马部落
  • 09响应式布局
  • 10做出我们自己的卡片
  • 11绝对布局和相对布局
  • 12复用自己的Card样式
  • 13网格布局
  • 14做几个自己用的按钮
  • 15使用矢量图标
  • 16变换与动画
  • 《TailwindCSS》
xugaoyi
2022-03-01
目录

08使用 Flexbox 布局

# 使用 Flexbox 布局

# 知识点

  • 使用 Flexbox 布局安排页面空间与控件

# 官网

https://tailwindcss.com/docs/flex-direction
https://tailwindcss.com/docs/justify-content

# Flexbox讲解

https://css-tricks.com/snippets/css/a-guide-to-flexbox/

# 实战演习

<!-- 默认布局 -->
<div class="text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 行布局 -->
<div class="flex flex-row text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 行布局(反转) -->
<div class="flex flex-row-reverse text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 列布局 -->
<div class="flex flex-col text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 列布局(反转) -->
<div class="flex flex-col-reverse text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>

<!-- 对齐内容 - 左对齐 -->
<div class="flex justify-start text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 对齐内容 - 右对齐 -->
<div class="flex justify-end text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 对齐内容 - 居中对齐 -->
<div class="flex justify-center text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 对齐内容 - 平均分布对齐1 -->
<div class="flex justify-between text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 对齐内容 - 平均分布对齐2 -->
<div class="flex justify-around text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 对齐内容 - 平均分布对齐3 -->
<div class="flex justify-evenly text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-10 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-10 bg-bootstrap_danger text-white m-2">3</div>
</div>

<!-- 水平轴对齐 - 原始 -->
<div class="text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-20 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-32 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 水平轴对齐 - 上对齐 -->
<div class="flex items-start text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-20 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-32 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 水平轴对齐 - 中对齐 -->
<div class="flex items-center text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-20 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-32 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 水平轴对齐 - 下对齐 -->
<div class="flex items-end text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-20 bg-bootstrap_success text-white m-2">2</div>
    <div class="w-10 h-32 bg-bootstrap_danger text-white m-2">3</div>
</div>
<!-- 水平轴对齐 - 基准线对齐 -->
<div class="flex items-baseline text-center bg-gray-100 mt-3">
    <div class="w-10 h-10 bg-bootstrap_primary text-white m-2">1</div>
    <div class="w-10 h-20 bg-bootstrap_success text-white m-2 flex  justify-center items-center">2</div>
    <div class="w-10 h-32 bg-bootstrap_danger text-white m-2">3</div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

# 课程文件

https://github.com/komavideo/LearnTailwindCSS

# 小马视频频道

http://komavideo.com

# 小马部落

https://discord.gg/VSKw72P

编辑 (opens new window)
上次更新: 2023/08/06, 00:38:41
07引入我要的字体
09响应式布局

← 07引入我要的字体 09响应式布局→

最近更新
01
课件-react路由-V6
01-22
02
课件-国际化
01-22
03
课件-redux-toolkit
01-22
更多文章>
Theme by Vdoing | Copyright © 2019-2024 Evan Xu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式