68.纯 CSS 创作一本色卡
原文地址:https://segmentfault.com/a/1190000015456554
感想:复习下 transform-origin: 位置;
HTML code:
<div class="cards">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
CSS code:
html, body {
margin:;
padding:;
}
/* 设置body子元素水平垂直居中*/
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: lightgray;
}
/* 重定义盒模型 */
.cards,
.cards > * {
/* width、height包括边框、内边距、内容区 */
box-sizing: border-box;
}
/* 设置容器样式 */
.cards {
position: relative;
font-size: 12px;
width: 20em;
height: 20em;
/* border: 1px solid blue; */
}
/* 画出色卡 */
.cards span{
width: 10em;
height: 3em;
border: 0.2em solid dimgray;
border-radius: 0.3em 0.8em 0.8em 0.3em;
/* 用 HSL 色彩模式为色卡上色 */
background-color: hsl(calc(360 / 8 * var(--n)), 80%, 70%);
position: absolute;
top: calc(50% - 3em / 2);
/* 定义动画效果,transform-origin定点绕其旋转 */
transform-origin: right;
animation: rotating 3s linear infinite;
animation-delay: calc((var(--n) - 8) * 0.15s);
}
@keyframes rotating {
0%, 35% {
transform: rotate(0deg);
}
90%, 100% {
transform: rotate(360deg);
}
}
/* 用伪元素画出色卡的标签 */
.cards span::before{
content:'';
width: 35%;
height: 100%;
border-left: 0.2em solid silver;
border-radius: 0 0.6em 0.6em 0;
background-color: white;
position: absolute;
right:;
}
.cards span::after {
content: '';
width: 0.4em;
height: 2em;
background-color: silver;
position: absolute;
left: 6.5em;
top: 0.1em;
box-shadow: 0.7em 0 0 -0.1em silver;
}
/* 为色卡设置变量 */
.cards span:nth-child(1) {
--n:;
}
.cards span:nth-child(2) {
--n:;
}
.cards span:nth-child(3) {
--n:;
}
.cards span:nth-child(4) {
--n:;
}
.cards span:nth-child(5) {
--n:;
}
.cards span:nth-child(6) {
--n:;
}
.cards span:nth-child(7) {
--n:;
}
.cards span:nth-child(8) {
--n:;
}
68.纯 CSS 创作一本色卡的更多相关文章
- 3.纯 CSS 创作一个容器厚条纹边框特效
原文地址:3.纯 CSS 创作一个容器厚条纹边框特效 没有啥好点子呀,不爽 HTML代码: <div class="box"> <div class=" ...
- 2.纯 CSS 创作一个矩形旋转 loader 特效
原文地址:2.纯 CSS 创作一个矩形旋转 loader 特效 扩展后地址:https://scrimba.com/c/cNJVWUR 扩展地址:https://codepen.io/pen/ HT ...
- 1.纯 CSS 创作一个按钮文字滑动特效 + 弹幕(残缺)
原文地址:1# 视频演示如何用纯 CSS 创作一个按钮文字滑动特效 扩展后地址:https://scrimba.com/c/cJkzMfd HTML代码: <html> <head& ...
- 75.纯 CSS 创作一支摇曳着烛光的蜡烛
原文地址:https://segmentfault.com/a/1190000015580809 学习后效果地址:https://scrimba.com/c/c8PQ3PTB 感想:CSS 真强大! ...
- 74.纯 CSS 创作一台 MacBook Pro
原文地址:https://segmentfault.com/a/1190000015568609 HTML code: <div class="macbook"> &l ...
- 73.纯 CSS 创作一只卡通狐狸
原文地址:https://segmentfault.com/a/1190000015566332 学习效果地址:https://scrimba.com/c/cz6EzdSd 感想:过渡效果,圆角,定位 ...
- 72.纯 CSS 创作气泡填色的按钮特效
原文地址:https://segmentfault.com/a/1190000015560736 感想:过渡效果+xyz中一轴. HTML code: <nav> <ul> & ...
- 71.纯 CSS 创作一个跳 8 字型舞的 loader
原文地址:https://segmentfault.com/a/1190000015534639#articleHeader0 感想:rotateX() 和rotateZ()一起使用好懵呀. HTML ...
- 70.纯 CSS 创作一只徘徊的果冻怪兽
原文地址:https://segmentfault.com/a/1190000015484852 感想:monster中边框角.上下动画.旋转动画.左右动画,眼睛中transform:scaleY(n ...
随机推荐
- Struts2 2.5版本的通配符和动态方法调用的问题
Struts2.5版本之后,使用通配符的时候出现错误 配置的四个action,使用通配符和动态方法的时候找不到其中的update方法后来经过查找才知道原来是版本加了一个 <action name ...
- Sql Server 2005/2008数据库被标记为“可疑”/“质疑”的问题
日常对Sql Server 2005关系数据库进行操作时,有时对数据库(如:Sharepoint网站配置数据库名Sharepoint_Config)进行些不正常操作如数据库在读写时而无故停止数据库,从 ...
- js 中数字与字符串之间的转换
数字转换为字符串 var num = 123: 1.num.toString 2."" + num 3.String(num) 将数字转化为格式化后的字符串 num.toFixe ...
- socket端口绑定后通过bat干掉
@echo off::port为需要去绑定端口set port=8888for /f "tokens=5 delims= " %%a in ('netstat -ano ^|fin ...
- HtmlUnit学习总结
HtmlUnit学习总结 转载 2016年09月13日 15:58:25 标签: htmlunit / 爬虫 7304 本文摘抄其他博客或者技术论坛,自己搜集整理如下: HtmlUnit学习总结 摘要 ...
- ubuntu16.04中如何启用floodlight的其中一种方式
1. 提前一台安装好mininet,另一台安装好floodlight 2. 在mininet里面的custom文件夹下自定义文件ProjectGroup10_Topology.py from mini ...
- cdcq的独立博客
cdcq的独立博客终于又复活啦,以后就用这个了 地址: http://cdcq.coding.me 现在用的是luogu的博客:https://cdcq.blog.luogu.org/
- 芯灵思SinlinxA33开发板 Linux平台总线设备驱动
1.什么是platform(平台)总线? 相对于USB.PCI.I2C.SPI等物理总线来说,platform总线是一种虚拟.抽象出来的总线,实际中并不存在这样的总线. 那为什么需要platform总 ...
- PythonStudy——闭包
# closure:被包裹的函数,称之为闭包 # 完整的闭包结构:1.将函数进行闭包处理:2.提升函数名的作用域 # 案例:延迟加载 def get_site(url): #url='https:// ...
- Adventure 魔幻历险
发售年份 1979 平台 VCS 开发商 雅达利(Atari) 类型 冒险 https://www.youtube.com/watch?v=YS-HYWRdb2g