当前位置: 首页 > news >正文

web前端之sass中的颜色函数、active按钮激活、hover鼠标悬浮、disabled禁用、scss循环、css

MENU

  • 效果图
  • html
  • sass
  • scss编译后的css
  • 页面css


效果图

注意查看蓝色按钮。


scssF1


scssF2


scssF3


html

<div class="box"><button class="btn type_1">按钮</button><button class="btn type_2">按钮</button><button class="btn type_3">按钮</button><button class="btn type_4">按钮</button><button class="btn type_5">按钮妞</button><button class="btn type_6">按钮</button><button class="btn type_7">按钮</button><button class="btn type_8">按钮</button><button class="btn type_9">按钮</button>
</div>

sass

$btnColors: #409eff, #67c23a, #f56c6c, #909399, #e6a23c, #fb7806, #8b590f, #f54343, #6c6d71;@for $i from 1 through length($btnColors) {.btn.type_#{$i} {$color: nth($btnColors, $i);background: $color;color: #ffffff;&:hover {background: lighten($color, 10%);}&:active {background: darken($color, 10%);}&:disabled {background: lighten($color, 10%);color: white;}}
}

scss编译后的css

.btn.type_1 {background: #409eff;color: #ffffff;
}.btn.type_1:hover {background: #73b8ff;
}.btn.type_1:active {background: #0d84ff;
}.btn.type_1:disabled {background: #73b8ff;color: white;
}.btn.type_2 {background: #67c23a;color: #ffffff;
}.btn.type_2:hover {background: #85cf60;
}.btn.type_2:active {background: #529b2e;
}.btn.type_2:disabled {background: #85cf60;color: white;
}.btn.type_3 {background: #f56c6c;color: #ffffff;
}.btn.type_3:hover {background: #f89c9c;
}.btn.type_3:active {background: #f23c3c;
}.btn.type_3:disabled {background: #f89c9c;color: white;
}.btn.type_4 {background: #909399;color: #ffffff;
}.btn.type_4:hover {background: #abadb1;
}.btn.type_4:active {background: #767980;
}.btn.type_4:disabled {background: #abadb1;color: white;
}.btn.type_5 {background: #e6a23c;color: #ffffff;
}.btn.type_5:hover {background: #ecb869;
}.btn.type_5:active {background: #d48a1b;
}.btn.type_5:disabled {background: #ecb869;color: white;
}.btn.type_6 {background: #fb7806;color: #ffffff;
}.btn.type_6:hover {background: #fc9338;
}.btn.type_6:active {background: #cb6003;
}.btn.type_6:disabled {background: #fc9338;color: white;
}.btn.type_7 {background: #8b590f;color: #ffffff;
}.btn.type_7:hover {background: #b97614;
}.btn.type_7:active {background: #5d3c0a;
}.btn.type_7:disabled {background: #b97614;color: white;
}.btn.type_8 {background: #f54343;color: #ffffff;
}.btn.type_8:hover {background: #f87373;
}.btn.type_8:active {background: #f21313;
}.btn.type_8:disabled {background: #f87373;color: white;
}.btn.type_9 {background: #6c6d71;color: #ffffff;
}.btn.type_9:hover {background: #85868b;
}.btn.type_9:active {background: #535457;
}.btn.type_9:disabled {background: #85868b;color: white;
}

页面css

body {padding: 0;box-sizing: border-box;margin: 0;min-height: 100vh;display: flex;justify-content: center;align-items: center;
}.box {width: 100%;display: flex;justify-content: center;
}button {padding: 0;padding: 8px 16px;margin: 0;border: 0;outline: none;background-color: transparent;border-radius: 2px;cursor: pointer;
}button:not(:first-child) {margin-left: 20px;
}
http://www.lryc.cn/news/349251.html

相关文章:

  • 交通地理信息系统实习教程(二)
  • Shell脚本——批量清理Kubernetes集群中Evicted状态的pod
  • (深度估计学习)Win11复现DepthFM
  • cocos creator 帧率60 不生效meta50 能刷新到90
  • 探讨 cs2019 c++ 的STL 库中的模板 conjunction 与 disjunction
  • 【核弹】我的第一款IDEA插件
  • 【工作篇】软件工程师的知识基础(持续更新)
  • 知识付费系统开源方案,教育机构如何利用朋友圈做转介绍?
  • c++20 std::reinterpret_cast、std::bit_cast、std::static_cast
  • PHP单独项目启动演示
  • vscode 通过ssh 远程执行ipynb +可以切换conda env
  • ASP.NET银行大厅自助信息系统的开发与实现
  • 学习Vue3中reactive
  • 【Transformer-BEV编码(10)】CVPR2021 PYVA 第一个明确提到 cross-attention decoder可用于视图转BEV
  • nestJs中跨库查询
  • Java编程思想
  • 数组(Java)
  • 接口自动化测试框架搭建
  • (四十二)第 6 章 树和二叉树(树的二叉链表(孩子-兄弟)存储)
  • 测试萌新Python学习(五)接口自动化测试requests
  • Python 机器学习 基础 之 监督学习 [朴素贝叶斯分类器] / [决策树] 算法 的简单说明 / [graphviz] 绘制决策树
  • QT日志类SimpleQtLogger的简单记录
  • 设计模式:观察者模式
  • ICode国际青少年编程竞赛- Python-5级训练场-带参数函数
  • 运维别卷系列 - 云原生监控平台 之 02.prometheus exporter 实践
  • OSPF基本配置
  • HIVE大数据平台SQL优化分享
  • JS算法-十大排序算法(上)
  • c++编程(11)——string类的模拟实现
  • Python从0到POC编写--函数