当前位置:网站首页>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 .
边栏推荐
- Electron official docs series: Processes in Electron
- MySQL数据库常见故障——遗忘数据库密码
- Uva5009 error curves three points
- Use the script to crawl the beautiful sentences of the sentence fan website and store them locally (blessed are those who like to excerpt!)
- Processing polyhedron change
- Explain C language 11 in detail (C language series)
- Basic configuration and test of Beifu twincat3 NCI in NC axis interface
- C - Common Subsequence
- zoopeeper设置acl权限控制(只允许特定ip访问,加强安全)
- Analysis of state transition diagram of Beifu NC axis
猜你喜欢
![[how to connect the network] Chapter 2 (Part 1): establish a connection, transmit data, and disconnect](/img/e3/a666ba2f48e8edcc7db80503a6156d.png)
[how to connect the network] Chapter 2 (Part 1): establish a connection, transmit data, and disconnect

Log in to the server using SSH key pair

Es6: iterator

Do you know the limitations of automated testing?
![[how to connect the network] Chapter 2 (next): receiving a network packet](/img/f5/33e1fd8636fcc80430b3860d069866.png)
[how to connect the network] Chapter 2 (next): receiving a network packet

享元模式(Flyweight)

Beifu PLC based on NT_ Shutdown to realize automatic shutdown and restart of controller

Analysis of state transition diagram of Beifu NC axis

Decorator

Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
随机推荐
Fire warning is completed within 10 seconds, and Baidu AI Cloud helps Kunming Guandu build a new benchmark of smart city
Digital signal processing -- Design of linear phase type (Ⅰ, Ⅲ) FIR filter (1)
HDU 3709 Balanced Number
code force Party Lemonade
解中小企业之困,百度智能云打个样
Electron official docs series: Contributing
Arcpy -- use of insertlayer() function: adding layers to map documents
[how to connect the network] Chapter 2 (Part 1): establish a connection, transmit data, and disconnect
Vivado error code [drc pdcn-2721] resolution
G - Cow Bowling
B - Bridging signals
Electron official docs series: References
IDC报告:百度智能云AI Cloud市场份额连续六次第一
Explain C language 10 in detail (C language series)
mysql讲解(一)
D - 滑雪
sed编辑器
Custom encapsulation drop-down component
Machine learning notes - seasonality of time series
Sinotech software outsourcing