How to use Flex layout to achieve scrolling of fixed content area in the head

How to use Flex layout to achieve scrolling of fixed content area in the head

The fixed layout of the page header was previously implemented with position:fixed, but now it can be implemented with flex layout, which is quick and convenient.

Advantages of Flex layout: 1. Does not destroy the HTML document flow 2. Better compatibility.

display: flex and display: -webkit-box are just names for different stages and there is no difference.

<view>
 <view class="header"></view>
 <view class="content"></view>
</view>
page{
 display: -webkit-box; //Set elastic layout -webkit-box-orient: vertical; //Set sub-element vertical layout height: 100%;
}
.header:{
  height: 50px; //Set the head height (fixed position)
}  
.content:{
  -webkit-box-flex: 1; //Set 1 equal part to fill the full screen overflow: auto //Set overflow scrolling}

Note: If there is no response, remove the outer view

This concludes this article on how to use Flex layout to achieve scrolling of fixed content area in the header. For more relevant Flex header fixed content area scrolling content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

<<:  Add ?v= version number after js or css to prevent browser caching

>>:  Understanding MySQL index pushdown in five minutes

Recommend

Explanation of the precautions for Mysql master-slave replication

1. Error error connecting to master 'x@xxxx:x...

Web Design Principles of Hyperlinks

<br />Related articles: 9 practical tips for...

How to implement Mysql scheduled task backup data under Linux

Preface Backup is the basis of disaster recovery....

Example code for text origami effect using CSS3

Preface This article mainly shares with you an ex...

How to install kibana tokenizer inside docker container

step: 1. Create a new docker-compose.yml file in ...

Implementation of vue+drf+third-party sliding verification code access

Table of contents 1. Background 2. Verification p...

How to implement image mapping with CSS

1. Introduction Image maps allow you to designate...

Analysis of statement execution order of sql and MySQL

I encountered a problem today: Can I use the as a...

An IE crash bug

Copy code The code is as follows: <style type=...

How to install WSL2 Ubuntu20.04 on Windows 10 and set up the docker environment

Enable WSL Make sure the system is Windows 10 200...

Web Design Experience: Efficiently Writing Web Code

Originally, this seventh chapter should be a deep ...

Examples of using html unordered list tags and ordered list tags

1. Upper and lower list tags: <dl>..</dl...