news 2026/3/6 3:46:15

常用的css

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
常用的css

js控制样式:

//html中: <text class="test_text" :style="{'--base_color':currentColor}">测试</text> //data中: currentColor:'pink' //methods中: this.currentColor='red' //style中:使用变量取值 .test_text{ color: var(--base_color); }

flex布局

@mixin flex($direction: row, $justify: center, $align: flex-start) { display: flex; flex-direction: $direction; justify-content: $justify; align-items: $align; } //使用 @include flex(row, center, center);

css绘制勾选按钮 示例:

.check_box { width: 32rpx; height: 32rpx; border-radius: 50%; margin-right: 20rpx; border: 2rpx solid #FF7537; box-sizing: border-box; position: relative; &_half_check { border-color: #FF7537; &::after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; width: 16rpx; height: 4rpx; color: #FF7537; background: #FF7537; } } &_active { background: #FF7537; border: 2rpx solid #FF7537; border-color: #FF7537; padding-bottom: 4rpx; @include flex(row, center, center); &::after { content: ''; width: 16rpx; height: 8rpx; border-left: 2rpx solid #fff; border-bottom: 2rpx solid #fff; transform: rotate(-45deg); margin: auto } } }

底部操作按钮:如

.btn-wrap { background: #FFFFFF; box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(242, 242, 242, 0.5); padding: 20rpx 16rpx calc(env(safe-area-inset-bottom) + 16rpx); display: flex; gap: 16rpx; justify-content: space-between; align-items: center; width: 100%; position: fixed; bottom: 0; .btn { height: 88rpx; line-height: 88rpx; text-align: center; border-radius: 16rpx; font-size: 32rpx; flex: 1; border: 2rpx solid #FF7537; color: #FF7537; background: #FFFFFF; } .confirm_btn{ border: 2rpx solid #FF7537; background: #FF7537; color: #FFFFFF; } }

滚动渐变背景:

//动态style :background="`rgba(255,255,255,${pageScrollTop / 100 * 1.2}) `" //生命周期中 onPageScroll({ scrollTop }) { this.pageScrollTop=scrollTop },
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/3/4 2:26:16

枚举中间

lc lc2964 枚举中间hash class Solution { public: int divisibleTripletCount(vector<int>& nums, int d) { int n nums.size(); if (n < 3) return 0; int ret 0; unordered_map<int, int> hash; hash[nums[0] % d]; // 枚举中间 for (int i 1; i &l…

作者头像 李华
网站建设 2026/2/27 8:48:28

三菱PLC六层电梯控制系统设计含报告程序【程序与文档】(设计源文件+万字报告+讲解)(支持资料、图片参考_相关定制)_文章底部可以扫码

三菱PLC六层电梯控制系统设计含报告程序【程序与文档】(设计源文件万字报告讲解)&#xff08;支持资料、图片参考_相关定制&#xff09;_文章底部可以扫码组态川基于三菱PLC的六层电梯控制系统设计[配套设计报告&#xff0c;程序&#xff0c;组态) 含基于三菱PLC的六层电梯控制…

作者头像 李华
网站建设 2026/3/5 13:26:58

如何通过单北斗GNSS实现高效的变形监测与位移监测?

在当前工程监测与地质灾害预警的背景下&#xff0c;单北斗GNSS技术愈发显得重要。它融合了高精度定位与实时数据传输&#xff0c;为各种监测需求提供了定制化解决方案。单北斗变形监测设备因其使用灵活、维护方便&#xff0c;广泛应用于基础设施建设、水坝监管等领域。同时&…

作者头像 李华
网站建设 2026/2/21 11:36:03

Spring AI Alibaba官方文档下载(V1.1版本)

前言 为了方便大家学习和查阅&#xff0c;我花了几小时从官方文档整理并重新排版了这份资料。为了节省打印成本&#xff0c;特意精简了非核心的 import 语句等冗余代码。内容干货满满&#xff0c;非常适合打印出来随时翻阅。欢迎下载学习&#xff0c;一起在 AI 时代共同进步&a…

作者头像 李华
网站建设 2026/3/6 3:11:58

Spring Mvc(二)

一.获取Cookie,Session,Header 在处理http请求时,先明白http协议是"无状态"的(指服务器默认不会保留客户端请求之间的任何信息。)会导致用户登录状态、购物车内容等连续性功能无法直接实现。解决该问题据需要用到Cookie和Session,接下来进行解释: 1.Cookie 和 Sess…

作者头像 李华