表格将水平增长而不是垂直增长
P粉087074897
P粉087074897 2023-09-15 17:32:14
[CSS3讨论组]

我正在尝试制作一个计算器,目前正在研究 HTML 和 CSS。我正在尝试使计算器在垂直和水平方向上都更大。我可以使用 width: 100% 或 flex: 1 1 100% 轻松增加宽度以适应容器;但是,每当我尝试用 height: 100%; 增加高度时它超出了容器的范围,输入按钮变得很大。我尝试过使用 flex-basis 和 flex-grow 让它也垂直增长,但我做不到。


    
html { height: 100%; } body { display: flex; justify-content: center; align-items: center; margin: 0; height: 100%; } .container { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; height: 50%; width: 30%; } form { flex: 0 1 100%; } .column1, .column2, .column3, .column4, .column5, .display { display: flex; height: 100%; } .column1 input, .column2 input, .column3 input, .column4 input, .column5 input, .display input { flex: 1 1 100%; }

P粉087074897
P粉087074897

全部回复(1)
P粉574268989

以下是具体操作方法:

.container{
    /* height: 50%; */
    width: 100%;
}

.column1, .column2, .column3, .column4, .column5, .display{
    height: calc(100vh/6);
    /* Distributing the viewport height within 6 columns */
}
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号