html - 如何弯曲结束一个孩子而不是别的
问题描述
我试图在 .app 的 flex-end 上只有 div3 而没有其他内容。
如果我使用以下代码:
.app {
display: flex;
flex-direction: column;
height: 100vh;
justify-content: flex-end;
}
我在我想要的地方得到了 div3,但其他所有内容也跟随它到屏幕底部。
所以我尝试了这个,但没有奏效:
.app {
display: flex;
flex-direction: column;
height: 100vh;
}
.app > .div3 {
justify-content: flex-end;
}
.app {
display: flex;
flex-direction: column;
height: 100vh;
}
.app>.div3 {
justify-content: flex-end;
}
<div class="app">
<div class="div1">
<h1>Hello</h1>
<div class="div2">
<h1>Hello</h1>
<div class="div3">
<h1>Hello</h1>
<input type="input" class="input">
</div>
</div>
</div>
</div>
解决方案
.app {
display: flex;
flex-direction: column;
height: 100vh;
}
.div3 {
align-items: flex-end;
flex-direction: column;
display: flex;
}
<div class="app">
<div class="div1">
<h1>Hello</h1>
</div>
<div class="div2">
<h1>Hello</h1>
</div>
<div class="div3">
<h1>Hello</h1>
<input type="input" class="input">
</div>
</div>
推荐阅读
- python - Python 我可以使用 Tkinter 打印到打印机吗
- python - Problem with KerasRegressor & multiple output
- python-3.x - Anaconda 不启动 python 程序
- c++ - 安装没有 lib 文件的 OpenCV
- function - 将 Vue 路由参数转为整数
- python - 如何安装 mat2vec Python 包?
- python - 如何使用 Python 执行 pickle 序列化类远程主机
- python - Pygame:AttributeError:'pygame.Surface'对象没有属性'display'
- html - 修改Html表单提交输出
- save - macOS 计算机中的 SwiftUI Catalyst App - 我应该使用哪个路径将图像保存在我的 Mac 本地磁盘中?