当前位置:网站首页>flex/fixed上中下(移動端)
flex/fixed上中下(移動端)
2022-06-12 05:34:00 【昔冰_G】
方案一:不使用fixed
html{
height:100vh;
/* 如果這裏不給100%,那就會認為自動,那底部欄就跑到最下面了(視口外) */
font-size:26.667vw;
/*
100vw=375px 1px=0.26667vw
為方便計算所以設定font-size為100px,也就是26.667vw
為了實現跟隨屏幕改變,所以這裏用的vw基准,而不是固定的px
*/
}
body{
width:100%;
height:100%;
/* 如果這裏不給100%(父高100%),那就會認為自動,那底部欄就跑到最下面了(視口外) */
display: flex;
font-size: 0.16rem;
flex-direction: column;
}
header{
height:.67rem;
/* 測得67px就是 67/(html的font-size)=67/100=0.67rem */
}
main{
flex:1;
overflow:auto;
}
footer{
height:.5rem;
}方案二:使用fixed
html{
height:100vh;
/* 如果這裏不給100%,那就會認為自動,那底部欄就跑到最下面了(視口外) */
font-size:26.667vw;
/*
100vw=375px 1px=0.26667vw
為方便計算所以設定font-size為100px,也就是26.667vw
為了實現跟隨屏幕改變,所以這裏用的vw基准,而不是固定的px
*/
}
body{
width:100%;
height:100%;
/* 如果這裏不給100%(父高100%),那就會認為自動,那底部欄就跑到最下面了(視口外) */
font-size: 0.16rem;
}
header{
height:.67rem;
/* 測得67px就是 67/(html的font-size)=67/100=0.67rem */
positon:fixed;
left:0;
bottom:0;
}
main{
overflow:auto;
padding-top:0.67rem;
/* 由於header固定了,脫離文檔流,所以這裏往下擠一下才能顯示main的原被header遮掩的部分內容 */
padding-bottom:.5rem;
/* 對應footer的高度,避免被底部遮掩,向上擠一下 */
}
footer{
height:.5rem;
positon:fixed;
left:0;
bottom:0;
}边栏推荐
- Simple introduction to key Wizard
- 57 - II. Continuous positive sequence with sum s
- Qs100 at command mqtt access thingsboard
- Reason: Canonical names should be kebab-case (‘-‘ separated), lowercase alpha-numeric characters and
- What is thinking
- [getting to the bottom] five minutes to understand the combination evaluation model - fuzzy borde (taking the C question of the 2021 college students' numerical simulation national competition as an e
- MySQL Linux Installation mysql-5.7.24
- Legal liabilities to be borne by the person in charge of the branch
- 59 - I. maximum value of sliding window
- Detailed analysis of the 2021 central China Cup Title A (color selection of mosaic tiles)
猜你喜欢

Wireshark filter rule

Automated test - dark horse headline test project
![[fastapi] use pycharm to configure and use environment variables for fastapi projects](/img/a5/47cabfed3f12bf70b4b047ef29fc9d.jpg)
[fastapi] use pycharm to configure and use environment variables for fastapi projects

WiFi band resources

Esp32-who face detection

WebRTC AEC 流程解析

公司注册认缴资金多久

Go interface oriented programming practice

16. sum of the nearest three numbers

Test work summary - performance test indicators
随机推荐
43. Number of occurrences of 1 in 1 ~ n integers
[JS knowledge] easily understand JS anti shake and throttling
Performance test - performance test tool analysis
Computer network connected but unable to access the Internet
How long is the company's registered capital subscribed
62. the last number left in the circle
Esp32-who face detection
Greenplum【问题 05】Greenplum Streaming Server自定义客户端问题处理(不断增加ing)
Variables and data types
Automated testing - Po mode / log /allure/ continuous integration
基于tensorflow的校园绿植识别
Detailed explanation of data envelopment analysis (DEA) (taking the 8th Ningxia provincial competition as an example)
Index fund summary
Legal liabilities to be borne by the person in charge of the branch
Simple introduction to key Wizard
org. apache. ibatis. binding. BindingException: Invalid bound statement (not found)
Multi thread learning III. classification of threads
Stm32f4 ll library multi-channel ADC
国企为什么要上市
Abstract methods and interfaces