当前位置:网站首页>After the element uses align items center and overflow auto, some contents are not fully displayed
After the element uses align items center and overflow auto, some contents are not fully displayed
2022-06-30 00:39:00 【Zheng One Dream】
When we use to center the content align-items center After the attributes , Because the small screen will block part of the content
We'll add... To the box overflow-y auto This attribute
But when we zoom out , Will find , The top half of the content will not be displayed
<style>
.box {
height: 100vh;
display: flex;
align-items: center;
overflow-y: auto;
}
.content {
height: 600px;
}
</style>
<body>
<div class="box">
<div class="content"></div>
</div>
</body>This is because the element is centered on the side axis . If the height of the element on the side axis is higher than its container , Then the overflow distance is the same in both directions
Reference documents :
align-items - CSS( Cascading style sheets ) | MDN
Here are two solutions :
1. Nested box
<style>
.container {
height: 100vh;
display: flex;
align-items: center;
overflow-y: auto;
}
.box {
height: 100%;
}
.content {
height: 600px;
}
</style>
<body>
<div class="container">
<div class="box">
<div class="content"></div>
</div>
</div>
</body>2. take display flex Change it to display grid
<style>
.box {
height: 100vh;
display: grid;
align-items: center;
overflow-y: auto;
}
.content {
height: 600px;
}
</style>
<body>
<div class="box">
<div class="content"></div>
</div>
</body>====================== Here's some bullshit , Don't look
because csdn Pretend you know the quality of the article
What you write less is poor quality , It won't push you up , It's funny
csdn New quality inspection function , Really? 6,“ yyds ”
I believe that this problem , My answer can solve 100% The problem of , You said my article was not good enough ?
Do you want me to write a lot of nonsense in the article ?
边栏推荐
- Statistical query of SQL Server database
- Connection query of SQL Server database
- Yunna | fixed assets information system management, information-based fixed assets management
- Common interview questions for network workers: Telnet, TTL, router and switch
- [QNX Hypervisor 2.2用户手册]6.2.2 Guest与Host之间通信
- How to design test cases
- TwinCAT 3 EL7211模块控制倍福伺服
- MySQL basics 1
- [PHP] PHP pressure test, error reporting: generally, each socket address (Protocol / network address / port) is only allowed to be used
- MySQL Foundation 2
猜你喜欢

SOFARegistry 源码|数据同步模块解析

Sword finger offer II 035 Minimum time difference

Quick pow: how to quickly find power

云呐|固定资产信息系统管理,信息化固定资产管理

月薪没到30K的程序员必须要背的面试八股,我先啃为敬!

Connection query of SQL Server database

Briefly: how are fragments communicated?

面试官:大量请求 Redis 不存在的数据,从而影响数据库,该如何解决?

Le module twincat 3 el7211 contrôle les servocommandes baffle

Interviewer: why does database connection consume resources? I can't even answer.. I was stunned!
随机推荐
阿于的彩虹桥
IO stream summary
岁月匆匆那年
关联性——典型相关分析
【服装软件】服装出产办理体系选型的准则有哪些?
单位固定资产怎么管理,行政单位的固定资产应该怎么管理
2022年最新最详细IDEA关联数据库方式、在IDEA中进行数据库的可视化操作(包含图解过程)
[lorawan node application] the application and power consumption of Anxin ra-08/ra-08h module in lorawan network
About SQL: create a view_ XB view, whose function is ① to delete views with duplicate names before creating them ② to display the number of male and female students in this class in the XSB table, and
Which department should the company's fixed assets be managed? How should the company's fixed assets be managed
About the case of SQL statements
微信支付 APP端 第三弹 申请退款
php微信商家转账到零钱 发起商家转账API
网络方向哪个发展更好?数据通信工程师学习路线分享
IDEA工具快捷键的使用
Yunna | fixed assets information system management, information-based fixed assets management
手写C语言之函数的嵌套调用和链式访问
[programming problem] maze problem
MySQL基础2
Time flies that year