-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
33 lines (32 loc) · 1.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
/* 列表仅水平滚动 */
.list { display: flex; overflow-y: hidden;}
/* 主内容宽度100%,白色背景覆盖 */
.content { flex: 0 0 100vw; background-color: #fff; position: relative; }
/* 空标签元素,作用是腾出水平滚动空间 */
.space { flex: 0 0 4rem; }
/* 按钮绝对定位,藏在内容白色背景后面 */
.button { width: 4rem; position: absolute; right: 0; }
.list { scroll-snap-type: x mandatory; }
.space { scroll-snap-align: end; }
.content { scroll-snap-align: start; }
</style>
</head>
<body>
<div class="list">
<button class="button" data-type="danger">删除</button>
<a href="javascript:" class="content">我是列表,试试左滑我</a>
<s class="space"></s>
</div>
</body>
</html>