html - 更改div中的弹性顺序?
问题描述
我正在尝试有一个 flex-col,图像首先出现在哪里。但是,下面的代码只会在 flex 方向为 row(左图)时更改顺序。它不适用于行。
</head>
<body>
<div class="flex-row">
<div class="order-2">
<h1>Flying Kites</h1>
<h2>Subheader</h2>
</div>
<img class="order-1" src="/examples/images/kites.jpg" alt="Flying Kites">
</div>
</body>
</html>
解决方案
In order to have classes order-x
work, the parent element needs to be flex
:
<div class="flex">
<div class="order-2">
<h1>Flying Kites</h1>
<h2>Subheader</h2>
</div>
<img class="order-1" src="/examples/images/kites.jpg" alt="Flying Kites">
</div>
See live example: https://play.tailwindcss.com/AFxRfm5JjN
See doc usage: https://tailwindcss.com/docs/order#usage
推荐阅读
- typescript - 用于删除对象数组中的重复项的 Angular 自定义管道
- python - 如何清除 tkinter 窗口 Python?
- discord - 为什么机器人不提及用户?
- core-data - 当 Codegen 处于 ClassDefinition 或 Category/Extension 中时,如何让 SwiftUI 预览工作?
- python - 我的不和谐机器人刚刚坏了,我不知道为什么(discord.py)
- android - 适用于 Android 的 IntelliJ IDEA 上的 Gradle 同步错误
- c# - 如何使用参数 ASP.NET MVC 调用 Ajax 数据表?
- node.js - 如何将 jwt 从 swift 客户端传递到 node.js 服务器
- unix - AWK 在 shell 内打印意外的换行符或字符串结尾
- flutter - 提供者对象在现有构建期间请求重建