当前位置:网站首页>There are many contents in the widget, so it is a good scheme to support scrolling
There are many contents in the widget, so it is a good scheme to support scrolling
2022-06-26 13:20:00 【YSoup】
Preface
For those who have written about Android Nativity , May follow the thought pattern , Use directly in small programs scroll-view To achieve scrolling . This is actually a bad idea , Because it has been written in the wechat applet document , When using vertical scrolling , Need to give scroll-view To specify a Fixed height , Here's the picture :
Are you kidding me? , When the list is small , Specify fixed height , That's bound to leave a lot of room , Are you ugly ? Such as below , The gray area is the scrolling area , The list has only two items :

What I want to do is , Let the scrolling area just wrap the contents , Only to a certain extent , The scrolling effect appears . I tried to give scroll-view Tag plus height:fit-content And the designation max-height attribute , But for the scroll-view Come on , It's no use at all .
terms of settlement
The solution is very simple , Use css Of overflow Properties will do , Don't use scroll-view label , The code is as follows :
<!DOCTYPE html>
<html>
<head>
<title> Rolling test </title>
<style> .scrollDiv {
max-height: 200px; background: #aaa; overflow: auto; } </style>
</head>
<body>
<div class="scrollDiv">
<ol>
<li> Cow cat </li>
<li> Orange cat </li>
</ol>
</div>
</body>
</html>
It specifies overflow: auto And maximum height max-height: 200px; after , Then I can achieve the effect I want . Insufficient content height 200px when , There is no scrolling effect , When there are more and more kinds of cats , The content height exceeds 200px after , A scrolling effect will appear . In this way , There will not be a lot of white space in the scrolling area . Of course , Here I take it directly HTML For example , The above css The style also applies to applets .
边栏推荐
- Dark horse notes - Common APIs
- Processsing function random
- POJ 3070 Fibonacci
- Adapter mode
- MySQL讲解(二)
- map 取值
- Electron official docs series: Contributing
- Don't mess with full_ Case and parallel_ CASE
- 首批通过!百度智能云曦灵平台获信通院数字人能力评测权威认证
- Use the script to crawl the beautiful sentences of the sentence fan website and store them locally (blessed are those who like to excerpt!)
猜你喜欢

桥接模式(Bridge)

C language: Exercise 2

2. Introduction to parallel interface, protocol and related chips (8080, 8060)

IDC report: the AI cloud market share of Baidu AI Cloud ranks first for six consecutive times

8、【STM32】定时器(TIM)——中断、PWM、输入捕获实验(一文精通定时器)

scrapy——爬取漫画自定义存储路径下载到本地
![HDU1724[辛普森公式求积分]Ellipse](/img/57/fb5098e150b5f3d91a5d0983a336ee.png)
HDU1724[辛普森公式求积分]Ellipse

Script - crawl the customized storage path of the cartoon and download it to the local

Basic methods for network diagnosis and hardware troubleshooting of Beifu EtherCAT module

首批通过!百度智能云曦灵平台获信通院数字人能力评测权威认证
随机推荐
Chapter 01_ Installation and use of MySQL under Linux
解中小企业之困,百度智能云打个样
Beifu PLC obtains system time, local time, current time zone and system time zone conversion through program
[how to connect the network] Chapter 2 (next): receiving a network packet
Adapter mode
D - skiing
Bridge mode
Summary of wechat applet test points
适配器模式(Adapter)
Beifu PLC realizes data power-off maintenance based on cx5130
Processing function translate (mousex, mousey) learning
B - Bridging signals
MySQL数据库讲解(三)
mariadb学习笔记
橋接模式(Bridge)
Digital signal processing -- Design of linear phase type (Ⅰ, Ⅲ) FIR filter (1)
Echart stack histogram: add white spacing effect setting between color blocks
Don't mess with full_ Case and parallel_ CASE
Electron official docs series: Examples
Uva10341 solve it