html - 添加 CSS 卡会在网站上留下不需要的白色空间
问题描述
在移动模式下使用网站时出现不需要的空白区域,并且 CSS 卡与容器重叠。当容器中只有一张卡时没有问题,但是当我尝试只添加一张时,就会出现空白。
请不要苛刻,因为我是一个自学成才的程序员。
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Montserrat', sans-serif;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
/*Media Queries*/
/*Set the media query for mobile*/
@media only screen and (max-width: 400px){
/*CSS rules for mobiles only*/
#nav-bar{
background-color: salmon;
}
}
/*Start of Stack */
#stack-cards{
display: flex;
}
#stack-container{
display: flex;
}
.stack{
background-color: #000000;
}
.stack header{
text-align: center;
justify-content: center;
color: #FCA311;
}
#card-css{
max-height: 50vh;
border-style: none;
justify-content: center;
align-items: center;
margin: 40px;
background: rgb(20,137,251);
background: linear-gradient(45deg, rgba(20,137,251,1) 15%, rgba(255,255,255,1) 100%);
}
#card-html5{
max-height: 50vh;
border-style: none;
justify-content: center;
align-items: center;
margin: 40px;
/*background: rgb(20,137,251);
background: linear-gradient(45deg, rgba(20,137,251,1) 15%, rgba(255,255,255,1) 100%);*/
background: rgb(240,101,41);
background: linear-gradient(45deg, rgba(240,101,41,1) 15%, rgba(255,255,255,1) 100%);
}
#card-bootstrap{
max-height: 50vh;
border-style: none;
justify-content: center;
align-items: center;
margin: 40px;
background: rgb(90,20,251);
background: linear-gradient(45deg, rgba(90,20,251,1) 15%, rgba(255,255,255,1) 100%);
}
解决方案
放置带有 flex 方向的卡片:列。
推荐阅读
- qt - 具有半透明背景的 Qt 无框窗口,没有错误“UpdateLayeredWindowIndirect failed”
- modal-dialog - 模态在屏幕外打开,几秒钟后又回到屏幕内
- react-native - 如何在全屏 react-native android 中播放视频
- r - R - 无法计算 data.frame 中过滤列的平均值
- odoo - 在浏览器上的特定空闲时间后过期 odoo 会话(自上次活动以来)
- javascript - 扩展窗口类
- django - 将 Django 网站中的表单数据应用到 .exe 文件以生成链接
- android - 检查 Firebase 事件是否成功执行
- android - 如何在 Android 上为一周中的特定日子安排闹钟?
- delphi - 调用汇编语言函数导致“浮点堆栈检查”异常