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,很少看博客,对你有帮助别忘记点赞收藏。

相关推荐
你的电影很有趣19 小时前
lesson55:CSS导航组件全攻略:从基础导航条到动态三级菜单与伸缩菜单实现
前端·css
蔗理苦19 小时前
2025-09-05 CSS4——浮动与定位
开发语言·前端·css·html·css3
slim~1 天前
javaweb基础第一天总结(HTML-CSS)
前端·css·html
F2E_Zhangmo1 天前
基于cornerstone3D的dicom影像浏览器 第二章 加载本地文件夹中的dicom文件并归档
前端·javascript·css
蔗理苦1 天前
2025-09-05 CSS3——盒子模型
前端·css·css3
qq_510351591 天前
vw 和 clamp()
前端·css·html
我的写法有点潮2 天前
最全Scss语法,赶紧收藏起来吧
前端·css
Mo_jon2 天前
css 遮盖滚动条,鼠标移上显示
前端·css
写不出来就跑路2 天前
基于 HTML+CSS+JavaScript 的薪资实时计算器(含本地存储和炫酷动画)
javascript·css·html
我的写法有点潮2 天前
Scss 的四种导入方式你都知道吗
前端·css