CSS常遇到自适应高度动画、带三角气泡阴影一行样式解决

效果图

.wxml

复制代码
<!-- 滤镜阴影 -->
<view class="container dropShadow" />
<!-- 盒子阴影 -->
<view class="container boxShadow" />
<!-- 文本阴影 -->
<view class="textShadow">换日线</view>
<!-- 自适应高度过渡动画 -->
<button bind:tap="updateDrop">{{drop?'收起':'展开'}}</button>
<view class="clipPath {{drop?'clipPathAction':''}}">
  <text>https://blog.csdn.net/qq_43764578\n占位\n占位\n占位\nhttps://blog.csdn.net/qq_43764578\n占位\n占位\n占位</text>
</view>

.wxss

复制代码
page{text-align: center;}
.container{
  width: 300rpx;
  height: 100rpx;
  border-radius: 20rpx;
  background: #99CCFF;
  position: relative;
  margin: 100rpx auto 0;
}
.container::after{
  content: '';
  width: 0;
  height: 0;
  border: 10px solid transparent;
  border-right-color: #99CCFF;
  position: absolute;
  left: -20px;
  top: 0;
  bottom: 0;
  margin: auto 0;
}
.dropShadow{
  filter: drop-shadow(0 0 10rpx red);
}
.boxShadow{
  box-shadow:0 0 10px red;
}
.textShadow{
  text-shadow: 0 0 2px red;
  margin: 100rpx auto 50rpx;
}
.clipPath{
  background: #99CCFF;
  padding: 30rpx;
  box-sizing: border-box;
  width: 600rpx;
  margin: 30rpx auto 0;
  clip-path: inset(0 0 100% 0);
  transition: all 0.3s;
}
.clipPathAction{
  clip-path: inset(0 0 0 0);
}

.js

复制代码
Page({
  data: {
    drop:false
  },
  updateDrop(){
    this.setData({
      drop:!this.data.drop
    })
  },
})

遇到问题可以看我主页加我Q,很少看博客,对你有帮助别忘记点赞收藏。

相关推荐
里欧跑得慢1 天前
17. Flutter Hero动画实现:让界面过渡更加优雅
前端·css·flutter·web
凯瑟琳.奥古斯特1 天前
Redis是什么及核心特性
前端·css·redis·缓存
DFT计算杂谈1 天前
VASP官方教程 TRIQS DFT+DMFT计算教程
运维·css·自动化·html·css3
可达鸭小栈1 天前
易语言实现CSS像素文字生成器:无需字体文件渲染汉字
前端·css
yqcoder1 天前
CSS 迷思破解:`:nth-child` vs `:nth-of-type`
前端·css
遇见~未来1 天前
第六篇_CSS进阶_深入浏览器与工程化
前端·css·rust
xingpanvip1 天前
星盘接口开发文档:日运语料接口指南
android·开发语言·前端·css·php·lua
之歆2 天前
Day05_CSS完整博客笔记(下)
前端·css·笔记
之歆2 天前
Day05_CSS完整博客笔记(上)
前端·css·笔记
ZC跨境爬虫2 天前
跟着 MDN 学 HTML day_7:(进阶文本语义标签全覆盖)
前端·javascript·css·ui·html