JSDM

HTML

 
1
<div class="wrapper">
2
  <input id="exp1" class="exp" type="checkbox">
3
  <div class="text">
4
    <label class="btn" for="exp1"></label>
5
    浮动元素是如何定位的,
6
    正如我们前面提到的那样,当一个元素浮动之后,它会被移出正常的文档流,然后向左或者向右平移,一直平移直到碰到了所处的容器的边框,或者碰到另外一个浮动的元素。
7
  </div>
8
</div>

CSS

x
 
1
* {
2
  margin: 0;
3
  padding: 0;
4
  box-sizing: border-box;
5
}
6
7
.wrapper {
8
  display: flex;
9
  margin: 50px auto;
10
  width: 300px;
11
  overflow: hidden;
12
  resize: horizontal;
13
  border-radius: 8px;
14
  padding: 15px;
15
  box-shadow: 20px 20px 60px #bebebe, -20px -20px 60px #ffffff;
16
}
17
18
.text {
19
  font-size: 20px;
20
  overflow: hidden;
21
  text-overflow: ellipsis;
22
  text-align: justify;
23
  position: relative;
24
  line-height: 1.5;
25
  max-height: 4.5em;
26
}
27
28
.text::before {
29
  content: '';
30
  height: calc(100% - 26px);
31
  float: right;
32
}
33
34
.text::after {
35
  content: '';
36
  width: 999vw;
37
  height: 999vw;
38
  position: absolute;
39
  box-shadow: inset calc(100px - 999vw) calc(30px - 999vw) 0 0 #fff;
40
  margin-left: -100px;
41
}
42
43
.btn {
44
  position: relative;
45
  float: right;
46
  clear: both;
47
  margin-left: 20px;
48
  font-size: 16px;
49
  padding: 0 8px;
50
  background: #3F51B5;
51
  line-height: 24px;
52
  border-radius: 4px;
53
  color: #fff;
54
  cursor: pointer;
55
}
56
57
.btn::after {
58
  content: '展开'
59
}
60
61
.exp {
62
  display: none;
63
}
64
65
.exp:checked+.text {
66
  max-height: none;
67
}
68
69
.exp:checked+.text::after {
70
  visibility: hidden;
71
}
72
73
.exp:checked+.text .btn::before {
74
  visibility: hidden;
75
}
76
77
.exp:checked+.text .btn::after {
78
  content: '收起'
79
}
80
81
.btn::before {
82
  content: '...';
83
  position: absolute;
84
  left: -5px;
85
  color: #333;
86
  transform: translateX(-100%)
87
}
? ?
? ?
必须是有效的URL
+ 添加另一个资源

JS

xxxxxxxxxx
1
 
1
必须是有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

  1. 暂无文件
拖动文件到上面的区域或者:
加载中 ..................