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Mi4zNiAxLjEzOHYyLjU1MiIvPjwvZz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiIGQ9Im0yMCAxNi43NzdjMCAxLjIzMy0xLjEyMSAyLjIzMy0yLjUwNiAyLjIzMy0xLjM4NCAwLTIuNTA2LTEtMi41MDYtMi4yMzN2LTIuNTUzYzAtMS4yMzQgMS4xMjItMi4yMzMgMi41MDYtMi4yMzMuMTc0IDAgLjM0My4wMTcuNTA2LjA0NnYtMS4zN2gtLjAzM2MuMDE3LS4yMi4wMzMtLjQ0MS4wMzMtLjY2NiAwLTQuNDE4LTMuNTgyLTgtOC04LTQuNDE4IDAtOCAzLjU4Mi04IDggMCAuMjI1LjAxNi40NDYuMDM0LjY2NmgtLjAzNHYxLjM3Yy4xNjMtLjAyOS4zMzMtLjA0Ni41MDUtLjA0NiAxLjM4NCAwIDIuNTA2Ljk5OSAyLjUwNiAyLjIzM3YyLjU1M2MwIDEuMjMzLTEuMTIyIDIuMjMzLTIuNTA2IDIuMjMzcy0yLjUwNS0uOTk5LTIuNTA1LTIuMjMzdi0yLjU1M2MwLS4yNTguMDU5LS41MDEuMTQ4LS43My0uMDg1LS4xNDgtLjE0OC0uMzEtLjE0OC0uNDkzdi0yLjY2N2MwLS4wMjMuMDEyLS4wNDMuMDEzLS4wNjctLjAwNC0uMDg4LS4wMTMtLjE3Ni0uMDEzLS4yNjYgMC01LjUyMyA0LjQ3Ny0xMCAxMC0xMCA1LjUyMyAwIDEwIDQuNDc3IDEwIDEwIDAgLjA5LS4wMDkuMTc4LS4wMTQuMjY2LjAwMi4wMjQuMDE0LjA0NC4wMTQuMDY3djJjMCAuMzA2LS4xNDUuNTY5LS4zNi43NTMuMjI0LjMzNC4zNi43Mi4zNiAxLjEzOHYyLjU1MiIvPjwvc3ZnPg==) no-repeat 0 8rpx/22rpx 20rpx;

推荐使用顺序:

background:imageurl repeat position/size color; //size一定要斜杠,跟在坐标的后面(先有位置,再识别大小)

三个点省略号兼容写法:

/* 超出部分的写法,有点兼容性问题,所以要这么写。加webkit */
/*定义为盒子显示*/
display: -webkit-box; 
/*定义为竖向编排显示*/
-webkit-box-orient: vertical;
/* 限制一个块元素显示的文本行数;超出需求以几行的方式显示,超出两行就... */
-webkit-line-clamp: 2; 
overflow: hidden;
/*文本溢出隐藏为省略号*/
text-overflow: ellipsis;

高斯模糊

设置background

filter: blur(40rpx);
opacity: 0.4;

box-sizing borderbox

image

.detail-info {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 320rpx;
  padding: 20rpx;
  box-sizing: border-box;//?
  align-items: center; // 竖向垂直居中
}

flex-grow

设置当父元素的宽度大于所有子元素的宽度的和时(即父元素会有剩余空间),子元素如何分配父元素的剩余空间。 flex-grow的默认值为0,意思是该元素不索取父元素的剩余空间,如果值大于0,表示索取。值越大,索取的越厉害。

给每一个子元素加上width:0。这样整个父元素的宽度就是剩余宽度,然后进行分配flex-grow,这个时候加上去的宽度就是实实在在的width。

width:0
假如当前宽度特别宽,超出父元素的剩余空间,就不会按照当前的比例分配,所以要设置为0,这样就不会按照没有内容的宽度去分配,而是当前弹性盒模型分配的比例分配

image

.detail {
  flex-grow: 1;
  line-height: 60rpx;
  width: 0; //这里注意,还可以重新看下解释
}

可参考这篇文章:https://blog.csdn.net/m0_37058714/article/details/80765562

tranfrom origin

.player-disc::after {
  content: '';
  width: 192rpx;
  height: 274rpx;
  position: absolute;
  top: -150rpx;
  left: 266rpx;
  background: url('https://s3.music.126.net/m/s/img/needle.png?702cf6d95f29e2e594f53a3caab50e12') no-repeat center/contain;
  transform: rotate(-15deg);
  transform-origin: 24rpx 10rpx;
  transition: transform 0.5s ease;
}

image

唱片旋转

.rotation{
  animation: rotation 12s linear infinite;
  -moz-animation: rotation 12s linear infinite;
  -webkit-animation: rotation 12s linear infinite;
  -o-animation: rotation 12s linear infinite;
}
@keyframes rotation{
  from {
    transform: rotate(0deg)
  }
  to {
    transform: rotate(360deg)
  }
}
/* 旋转暂停 */
.rotation-pause{
  animation-play-state: paused;
}

align-item center 纵轴居中

image

.container{
  display: flex;
  align-items: center;
}

image.png
image

flex布局,用了flex-wrap:wrap;自动换行属性


laomao
9 声望0 粉丝