html - 弯曲方向元素宽度
问题描述
我不知道为什么通过将 flex-direction 设置为列我的元素内部的宽度为 100%?我只想让它垂直方向,而不是更宽。我可以在不将元素包装在其他 div 中的情况下做到这一点吗?请看下面的例子:
<button class="button">Good width</button>
<div class="flex-content">
<button class="button">Wrong width</button>
</div>
.button {
height: 36px;
}
.flex-content {
display: flex;
justify-content: center;
flex-direction: column;
width: 100%;
border: 1px solid red;
}
https://codepen.io/anon/pen/QzGQQm
问候
解决方案
推荐阅读
- python - 如何以只读方式将表中的数据插入组合框?
- java - 有人可以向我解释这个快速排序算法吗?
- reactjs - 反应设置加载的最佳方式
- r - 在基础 R 中提取管道后的数据框列
- elasticsearch - 尽管文档存在,但 ElasticSearch 术语查询返回 0 个命中
- git - AWS CodeBuild 将 git 标签推送到远程导致“致命:无法读取 'https://github.com' 的用户名:没有这样的设备或地址”
- cmake - 如何强制 ctest 仅在某些子目录中运行单元测试?
- node.js - Express POST 不起作用,但 GET 和 PATCH 是
- linux - Github actions 无法运行 ubuntu 20.04 中的 config.sh 文件
- java - 模拟未注入的对象