JSDM

HTML

 
1
You don't need a DOCTYPE on CodePen. Just put here what you would normally put in the <body>.
2
<!DOCTYPE html>
3
<html>
4
<head>
5
  <meta charset="utf-8">
6
  <title>白鹿为霜</title>
7
  <style type="text/css">
8
    body{
9
      margin: 0;/*外边距  上下 左右*/
10
    }
11
    .heart{
12
      position: relative;
13
      width: 250px;
14
      height: 250px;
15
      background-color: ; 
16
      margin: 60px auto;
17
    }
18
    .heart:before{
19
      content: "";/*激活伪元素必要因素*/
20
      position: absolute;/*绝对定位属性  不受父级约束 */
21
      top: 0;
22
      left: 0;
23
      width: 100px;
24
      height: 160px;
25
      background-color: red;
26
      border-radius: 50px 50px 0px 0px;
27
      
28
      transform: rotate(-45deg);/*旋转 -左 +右*/
29
    }
30
    /*before和after在元素内容前后加入指定内容(伪类)*/
31
    .heart:after{
32
      content: "";/*激活伪元素必要因素*/
33
      position: absolute;/*绝对定位属性  不受父级约束 */
34
      top: 0;
35
      left: 0;
36
      width: 100px;
37
      height: 160px;
38
      background-color: red;
39
      border-radius: 50px 50px 0px 0px;
40
      transform: translate(43px) rotate(45deg);
41
    }
42
  </style>
43
</head>
44
<body>
45
  <div class="heart"></div>
46
 
47
</body>
48
</html>
49
!

CSS

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

JS

xxxxxxxxxx
17
 
1
/*16:9缩放*/
2
window.addEventListener('load', adaptation);
3
window.addEventListener('resize', adaptation);
4
5
function adaptation() {
6
  let el = document.getElementById('app')
7
  console.log({obj:el})
8
  const win_w = window.innerWidth;
9
  const win_h = window.innerHeight;
10
  const app_w = el.clientWidth;
11
  const app_h = el.clientHeight;
12
  const scale_w = win_w / app_w
13
  const sclae_h = win_h / app_h
14
  const left = -(app_w - win_w) / 2
15
  const top = -(app_h - win_h) / 2
16
  el.setAttribute('style', 'transform: scale(' + scale_w + ',' + sclae_h + ');left:' + left + 'px;top:' + top + 'px;');
17
}
必须是有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

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